androidNa21
androidNa21

Reputation: 19

Hide drawn line chart in MPAndroidChart

Suppose if I have multiple lines and one line I want to hide. How to do this? removeDataset will remove complete line but I just want to hide the line. Is it possible in this chart API?

Upvotes: 1

Views: 1077

Answers (3)

Juro_222
Juro_222

Reputation: 11

I know it is a bit late but I would suggest setting the color to transparent for the LineDataSet. Define the color: <color name="alpha">#00FFFFFF</color> and set it LineDataSet lineToBeHidden; lineToBeHidden.setColor(ResourceCompat.getColor(getResources(), R.color.alpha, null);

Additionally you can set the width to minimum lineToBeHidden.setLineWidth(0.2f) to maximize the performance.

Upvotes: 0

Pallavi Wattamwar
Pallavi Wattamwar

Reputation: 71

Using the Dashline feature we can solve this,set length to 0 to draw only the dots: dataSet.enableDashedLine(0f,1f,0f)

Upvotes: 3

Valentin Laurent
Valentin Laurent

Reputation: 11

Actually you can not "hide" a line in a linechart.

But you can register your lines in different array and set the array you need in your chart and notify your chart to refresh with the good array. (The one with / without your line)

This is simple and fast to set.

Hope it helps.

Upvotes: 0

Related Questions