Charts: Charts 3.0 unable to draw discontinuous line chart
I need to be able to draw an incomplete chart. That is, a complete x axis but a half complete y axis.
In previous versions, I would just have to add the labels to the x axis, which would render a full x axis.
Then I would need to add the half complete y values to the chart, then the chart would render the half complete y values but still the full x axis. I don’t see a way to do this in 3.0 since using a nil value in place of y is not allowed as it is expecting a double value:
for (int i = 0; i < pricesArray.count; i++){
double price = pricesArray[i][@"price"];
[chartValues addObject:[[ChartDataEntry alloc] initWithX:i y:price]];
}
I need to add an x data point with a nil y value. Please advise.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 8
- Comments: 25 (12 by maintainers)
@CAPIStkidd how do I make blank entries? Creating ChartDataEntry looks like it forces you to give it a double value, which does draw an incomplete chart the way I want it to but it messes with the scale of the y axis if I for example give the blank entries all 0 values.
The discontinuous line chart we meant is not ‘breaking lines’. It means there are some data have x-axis values , but the y-axis values are nil. We can do that in Charts 2.0. but can’t do that in Charts 3.0. For example, there are 12 months in the x-axis, only 2 of them have y-axis value, others is nil. I want to draw a 12-month chart, not a 2-month chart. How to do it ?
‘stock chart’ do explain what you need. What I would try is this: 1 set xAxis max is like 4:00 pm value 2 add entries like I did above, e.g.
I just make a quick tweak in ChartsDemo, it looks like (it has a slow animation, which I don’t know why yet):
Can this solve your problem?
The idea will be when you get new data you just update or create a new data and set it again, so it will ‘grow’ until 4:00pm
I have the same issue here. Don’t know why this issue is closed.
Hi. I hope my message finds all of you well amid this global crisis.
I am using latest version of chart library to plot a line chart.
My graph shows months till Feb21. I don’t want to show ‘zero’ values for all future months. It should be blank. Thats what I want to achieve.
I would need little guidance on how to make it.
This is a side effect of how the library changed how it does labeling.
The workaround for now is to make a second dataset with blank entries (so if you’re wanting 100 entries and only 75 are drawn, make a second dataset with 25 entries, numbered 75-99) and add it as well.