【问题标题】:How to display maximum hidden value line in top of maximum x axis mpandroidchart?如何在最大 x 轴 mpandroidchart 顶部显示最大隐藏值线?
【发布时间】:2016-05-24 12:14:05
【问题描述】:

当我在顶部和底部添加标签时,顶部和底部有一条水平线,效果很好。

但是当我只在底部显示标签时,顶部的水平线不显示,只在底部显示。如何在图表顶部显示水平线?

这是截图..

Sceanrio 1:当我在顶部和底部同时显示标签时,通过显示线条效果很好。

场景二:

您可以看到 x 轴标签顶部缺少行的位置,即 11 上方。12 未显示。

    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);

【问题讨论】:

    标签: android charts bar-chart mpandroidchart


    【解决方案1】:

    尝试以下方法,

    setDrawAxisLine(boolean enabled): 如果该行设置为 true 是否应在轴(轴线)旁边绘制。

    setDrawGridLines(boolean enabled):将此设置为 true 以启用绘图 轴的网格线。

    检查The AxisDocumentation of the MPAndroidChart library

    【讨论】:

    • 您可以尝试实现以上两种方法并查看结果。
    • 嗨,这将底部的数字减少到 1。
    • xAxis.setDrawLimitLinesBehindData(true);试试这个
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多