You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while working with bubble data sets and charts i noticed that in bubble data sets, even though the documentation for ChartBaseDataSet.colors says that colors are bound to data-set entries, when you assign colors to the data set and render it in a bubble chart view, Charts 3.0.2 bounds the data-set colors to the x-axis range, not the data-set entries. line 95 in BubbleChartRenderer.swift confirms this: for j in stride(from: _xBounds.min, through: _xBounds.range + _xBounds.min, by: 1)
that’s different from a similar line (299) in BarChartRenderer.swift: for j in stride(from: 0, to: buffer.rects.count, by: 1)
i had a hard time understanding why my color assignments weren’t being followed in bubble charts. the documentation for the BubbleChartDataSet and BubbleChartRenderer classes don’t mention this diversion from the guidance provided in ChartBaseDataSet.swift for the colors property.
however, because i have to “expand” my colors array to include slots for all the items in the x-axis to have the colors correctly assigned to the data entries on the chart, i wonder whether the issue is in the documentation or the implementation.
I'm trying to understand your question, but I don't understand your image. Are you asking you want to use entry index in the data set, instead of the x?
current bubble chart uses let color = dataSet.color(atIndex: Int(entry.x)) to determine the color. However, using the entry index seems equivalent to using entry.x here, because basically Int(entry.x) = j in bubble chart (unless you have specified user case where x is decimal rather than int).
for j in stride(from: _xBounds.min, through: _xBounds.range + _xBounds.min, by:1){
guard let entry = dataSet.entryForIndex(j)as?BubbleChartDataEntryelse{ continue }
what I debugged and print out j and Int(entry.x) is the same here.
if your x is decimal here and x=2.1, x=2.2 are two different x grid lines for you, Int(2.1) and Int(2.2) will lead to the same color while you want them two different color?
while working with bubble data sets and charts i noticed that in bubble data sets, even though the documentation for
ChartBaseDataSet.colors
says that colors are bound to data-set entries, when you assign colors to the data set and render it in a bubble chart view, Charts 3.0.2 bounds the data-set colors to the x-axis range, not the data-set entries. line 95 inBubbleChartRenderer.swift
confirms this:for j in stride(from: _xBounds.min, through: _xBounds.range + _xBounds.min, by: 1)
that’s different from a similar line (299) in
BarChartRenderer.swift
:for j in stride(from: 0, to: buffer.rects.count, by: 1)
i had a hard time understanding why my color assignments weren’t being followed in bubble charts. the documentation for the
BubbleChartDataSet
andBubbleChartRenderer
classes don’t mention this diversion from the guidance provided inChartBaseDataSet.swift
for the colors property.however, because i have to “expand” my colors array to include slots for all the items in the x-axis to have the colors correctly assigned to the data entries on the chart, i wonder whether the issue is in the documentation or the implementation.
attached are my supporting materials.
[iOSChartsDemo.zip](https://github.com/danielgindi/Charts/files/1347357/iOSChartsDemo.zip)
The text was updated successfully, but these errors were encountered: