【问题标题】:android mpchart barchart description postionandroid mp图表条形图描述位置
【发布时间】:2017-06-12 19:37:38
【问题描述】:

我在 Android 应用程序中使用的 MPchart 中的描述条形图有问题。

当我使用description.setPostion(3f, 3f) 方法时,描述消失了。 我不知道自定义位置的默认值。

非常感谢

Sample image of my results

【问题讨论】:

  • 这一直有效,现在我的描述现在没有显示。如果我刷新屏幕大约 5 次中的 1 次,则会显示。很奇怪。如果我使用 textAlign 而不是 setPosition 它每次都会绘制。

标签: android mpandroidchart


【解决方案1】:

您的描述隐藏在 TOP_LEFT 角落,所以使用代码,否则不要设置描述位置我的模拟器高度是 1280,重量是 720

    //get the height and width of the device
    DisplayMetrics ds = new DisplayMetrics();
    this.getWindowManager().getDefaultDisplay().getMetrics(ds);
    int width = ds.widthPixels;
    int height = ds.heightPixels;

    //set the custom description postion
    Description desc = new Description();
    desc.setText("Hai");
    desc.setTextSize(13f);
    desc.setPosition(width - 50,height - 175);
    graph.setDescription(desc);

下图“海”是对图形的描述

desc.setPosition(width - 50,height - 1250);//图:2 描述显示在最右边

“海”文字为说明

【讨论】:

    猜你喜欢
    • 2020-05-29
    • 2018-05-18
    • 2016-06-21
    • 1970-01-01
    • 1970-01-01
    • 2023-03-10
    • 2015-12-25
    • 2013-02-06
    • 1970-01-01
    相关资源
    最近更新 更多