2016-05-24 110 views
0

當我在頂部和底部添加標籤時,頂部和底部都有一條水平線,它完美地起作用。如何在最大x軸mpandroidchart頂部顯示最大隱藏值線?

但是,當我只在底部顯示標籤時,頂部的水平線不顯示,只顯示在底部。如何在圖表頂部顯示水平線?

下面是截圖..

Sceanrio 1:當我表現出頂部標籤和底部的作品通過展示線好。

enter image description here

方案2:

可以看到行缺少在高於11 12,即x軸標籤的上面沒有顯示。

enter image description here

barChart = (BarChart) findViewById(R.id.chart); 
    XAxis xAxis = barChart.getXAxis(); 
    xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); 
    backButton = (Button) findViewById(R.id.settings_back_button); 
    textName = (TextView) findViewById(R.id.text_names); 
    barChart.getLegend().setEnabled(false); 
    backButton.setOnClickListener(this); 
    barChart.setDescription(""); 
    barChart.getViewPortHandler().setMaximumScaleX(1f); 
    barChart.setDoubleTapToZoomEnabled(false); 

回答

0

試試下面的方法,

setDrawAxisLine(能布爾):如果沿着軸(軸線)線路 應繪製或不設置爲true。

setDrawGridLines(boolean enabled):將其設置爲true以啓用繪製軸線的網格線 。

檢查The AxisDocumentation of the MPAndroidChart library

+0

謝謝。所以我需要添加兩行? – Shadow

+0

你可以試試以上兩種方法並檢查結果。 –

+0

嗨,這可以將底數減少到1。 – Shadow

相關問題