Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line Chart not show empty values - Charts 3.0 #2176

Closed
cepages opened this issue Feb 20, 2017 · 3 comments
Closed

Line Chart not show empty values - Charts 3.0 #2176

cepages opened this issue Feb 20, 2017 · 3 comments

Comments

@cepages
Copy link

cepages commented Feb 20, 2017

Hi,

I'm trying to achieve show empty values in my chart. This is the closest I can get:

screen shot 2017-02-20 at 11 19 33

In this example when there is not data about, I set it to 0 and initially I set the minimum to 0.1 = yAxis.axisMinimum = 0.01;

I would like that the values different to 0 are joined together in the same line. So I tried to add only the values bigger than 0:

screen shot 2017-02-20 at 11 20 15

Because for the Chart 3.0 I need to add a value for X, I can't start with null values at the beginning of the Chart.

So, reading other issues I thought to create a second LineChartDataSet just with 0 values and hide it with clear color and alpha = 0.

Yeah! this is exactly the Chart a I want:
screen shot 2017-02-20 at 11 38 22

But there are two problems with this way:

  • Firstly it doesn't seem right to have to create a LineChartDataSet for zero values and then hide that LineChartDataSet one. Actually one of the consequences is I had to change the speed of the animation (faster) because obviously it takes longer to paint ( with clear color ).

  • Secondly I have one legend with two labels. I tried to remove the Zero Values one ( unsuccessfully), but again it seems I'm trying the wrong approach.

Any ideas?

Thanks :)

@liuxuan30
Copy link
Member

hmm, you are talking about line breaking right?
To achieve your third image, you can just insert these two points, and set x axis minimum and maximum, so you have the same visual.
We don't support line breaking officially yet, because it's not that easy to think about. I tried to implement this last year, also encountered many issues (like negative values, filling the rect below the line, etc)
Currently the quick around is to use multiple data sets ti simulate. Once there is a good solution for line breaking, we will do it.

@cepages
Copy link
Author

cepages commented Feb 21, 2017

@liuxuan30 thanks.

I don't think it's line breaking. To be honest the real issue it's my points don't start on the day 6 of Feb, but I want to show that there is no data for those days, that's why I have that empty space.

I was trying with:

xAxis.axisMinimum and xAxis.axisMaximum and works!

Thanks for the idea 👍

@irshad9998
Copy link

@cepages how to display Kg on top of yAxis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants