代码之家  ›  专栏  ›  技术社区  ›  Husein Kareem

从饼图(ios charts/pandroidchart)中删除所有切片文本

  •  20
  • Husein Kareem  · 技术社区  · 9 年前

    我知道删除x值的方法,但如何删除y值。我基本上不想在饼图上看到任何文本。

    该图显示了饼图顶部带有80.0和20.0标签的当前状态。 pie chart

    8 回复  |  直到 9 年前
        1
  •  45
  •   Milad Faridnia Alexey Zakharov    6 年前

    删除Y值

    使用 dataset.setDrawValues(false);

    删除X值

    使用 MyPieChart.setDrawSliceText(false);

        2
  •  23
  •   Govind Kumawat    6 年前

    对于 图表3.2.1版

    两个X-Y值均已启用

    pieChartDataSet.drawValuesEnabled = true
    pieChartView.drawEntryLabelsEnabled = true
    

    enter image description here

    删除Y值

    pieChartDataSet.drawValuesEnabled = false
    

    enter image description here

    删除X值

    pieChartView.drawEntryLabelsEnabled = false
    

    enter image description here

        3
  •  7
  •   Husein Kareem    9 年前

    没关系,我想出来了!

    pieChartView.data?.setValueTextColor(UIColor.clearColor())
    

    这至少是因为没有看到这些标签。

    另一种方法是将其设置为false:

    drawLabelsEnabled
    
        4
  •  7
  •   Morgan    9 年前

    要删除标签(xVals):

    pieChartView.drawSliceTextEnabled = false
    

    要删除值(yVals):

    pieChartDataSet.drawValuesEnabled = false
    
        5
  •  3
  •   Wingzero    9 年前

    drawLabelsEnabled 不会在图表上绘制任何标签。它适用于xAxis和yAxis

    检查所有基本配置: https://github.com/danielgindi/ios-charts/blob/master/Charts/Classes/Components/ChartAxisBase.swift

        6
  •  3
  •   Khushabu    7 年前

    在ios图表版本3.1.1中,您可以通过设置 pie_chart.drawEntryLabelsEnabled = NO;

        7
  •  2
  •   Energy    4 年前

    Mp Android图表, 请用这个

    若要删除x值,请使用pieChart.setDrawSliceText(false)。

    要删除y值,请使用pieChart.getData().setDrawValues(false)。

        8
  •  1
  •   DawnSong David H    9 年前

    在ios图表2.1.3中, dataset.drawValuesEnabled = NO; 以隐藏Y值。