HI.
I'm using this.
int index = 0;
while (true) {
if (index >= 90) break;
if (index < 70 || index > 80) {
values.add(new Entry(some_int_value, index));
}
index++;
}
I want this.. (A)
but now (B)
how to like (A) ?????
if can, I need example code
thanks for read.
use 2 datasets
2 datasets ?
really?
that is example.
I am already use 20 datasets.
if network problem, more 20 datasets create ? and again, again??
20, 40, 60, 80, 100 datasets ?
I'm quickly support null values.
......................or need another solution .............. :(
~~~ or next version support ? i want. wnat!
@PhilJay
The same requirement and the same problem.
Will you support this or can you provide some other advices please?
Using another dataset is not a nightmare :) Write recursive code to create dataset. Here is a quick pseudo example -Swift style :)-
...
let chartData = LineChartData()
for i in 0 ..< _myDataCollection.count {
createDataSet(data: chartData, index: i, offset: 0)
}
self.lineChartView.data = chartData
....
createDataSet(data: LineChartData, index: Int, offset: Int) {
var yValues : [ChartDataEntry] = [ChartDataEntry]()
for i in offset ..< _myLabels.count {
let point = _myDataCollection[index][i]
if(point == 0) {
if( (i + 1) < _myLabels.count) {
createDataSet(data: data, index: index, offset: i + 1)
}
break
} else {
yValues.append(ChartDataEntry(x: i, y: point))
}
}
let ds = LineChartDataSet(values: yValues, label: nil)
let lc = _myColorCollection[index]
ds.setColor(lc)
ds.lineWidth = 1.0
...etc...
data.addDataSet(ds)
}
Thank you @PhilJay , you are awesome!
Thank you @ali6p your example really helped me. Here is my example code in java:
`
public void createDataSet(List
List
for (int i = index; i < data.size(); i++) {
if (data.get(i) != null) {
double ypoint = data.get(i);
Entry entry = new Entry((float) i, (float) ypoint);
entries.add(entry);
entriesAll.add(entry);
} else if ((i+1) < data.size()) {
if (data.get(i+1) != null) {
createDataSet(data, i+1);
break;
}
}
}
if (entries.size() > 0) {
LineDataSet dataSet = new LineDataSet(entries, "");
dataSet.setLineWidth(2);
...etc...
lineData.addDataSet(dataSet);
}
}
`
@mir47 Thank you very much, helped me a lot.
Is there a way to show just one entry for the datasets in the legend?
Most helpful comment
Thank you @ali6p your example really helped me. Here is my example code in java:
` data, int index) { entries = new ArrayList<>();
public void createDataSet(List
List
`