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
I have created a CombinedChartView with lineDataSets and CandleDataSets. The CandleDataSets are used to highlight certain data points.
This has all worked fine except for the Legend. When I enable the legend it only shows legend information for the LineDataSets.
I looked into the LegendRenderer and discovered the problem arises here ->
@objc open func computeLegend(data: ChartData)
{
guard let legend = legend else { return }
if !legend.isLegendCustom
{
var entries: [LegendEntry] = []
// loop for building up the colors and labels used in the legend
for i in 0..<data.dataSetCount
...
The dataSetCount only counts lineDataSets and ignores the candleDataSet. So any data sets after the line data are ignored.
My setup looks like this;
`
self.chartView.data = CombinedChartData()
if let chartView = self.chartView
{
let allData = CombinedChartData()
allData.lineData = LineChartData()
for line in lineData.values
{
if line.isVisible
{
allData.lineData.addDataSet(line)
}
}
allData.candleData = CandleChartData()
for fiducialMark in buttonData.values
{
if fiducialMark.isVisible
{
allData.candleData.addDataSet(fiducialMark)
}
}
chartView.data = allData
chartView.chartDescription?.text = self.fileLabel.stringValue
chartView.needsDisplay = true
chartView.rightAxis.enabled = false
chartView.legend.enabled = true
}
`
The text was updated successfully, but these errors were encountered:
I have created a CombinedChartView with lineDataSets and CandleDataSets. The CandleDataSets are used to highlight certain data points.
This has all worked fine except for the Legend. When I enable the legend it only shows legend information for the LineDataSets.
I looked into the LegendRenderer and discovered the problem arises here ->
...
The dataSetCount only counts lineDataSets and ignores the candleDataSet. So any data sets after the line data are ignored.
My setup looks like this;
`
self.chartView.data = CombinedChartData()
if let chartView = self.chartView
{
let allData = CombinedChartData()
allData.lineData = LineChartData()
for line in lineData.values
{
if line.isVisible
{
allData.lineData.addDataSet(line)
}
}
allData.candleData = CandleChartData()
for fiducialMark in buttonData.values
{
if fiducialMark.isVisible
{
allData.candleData.addDataSet(fiducialMark)
}
}
chartView.data = allData
chartView.chartDescription?.text = self.fileLabel.stringValue
chartView.needsDisplay = true
chartView.rightAxis.enabled = false
chartView.legend.enabled = true
}
`
The text was updated successfully, but these errors were encountered: