Closed rodingbao closed 1 month ago
I'm currently fixing/improving the build system but will try to have a look at this soon.
I see you are using a custom color scheme. What method did you use to set the colors on the bar or column chart? Are you changing the wxChartsDefaultTheme or creating another theme entirely?
Actually, looking at your other bug report (https://github.com/wxIshiko/wxCharts/issues/228) it seems it's working for the line chart but that's weird because I think they use the same inputs. Are you doing anything different between the line chart and bar chart?
yes, they use the same inputs. no different between the line chart and bar chart. I changed the wxChartsDefaultTheme. I attached my code for reference.
wxChartsDatasetTheme *datasettheme = new wxChartsDatasetTheme();
if (chartType == B_CHART_VBAR)
datasettheme->SetColumnChartDatasetOptions(
wxColumnChartDatasetOptions(wxChartsPenOptions(color, 2), wxChartsBrushOptions(color)));
else if (chartType == B_CHART_HBAR)
datasettheme->SetBarChartDatasetOptions(
wxBarChartDatasetOptions(wxChartsPenOptions(color, 2), wxChartsBrushOptions(color)));
else if (chartType == B_CHART_VSBAR)
datasettheme->SetStackedColumnChartDatasetOptions(
wxStackedColumnChartDatasetOptions(wxChartsPenOptions(color, 2), wxChartsBrushOptions(color)));
else if (chartType == B_CHART_HSBAR)
datasettheme->SetStackedBarChartDatasetOptions(
wxStackedBarChartDatasetOptions(wxChartsPenOptions(color, 2), wxChartsBrushOptions(color)));
else
datasettheme->SetLineChartDatasetOptions(wxLineChartDatasetOptions(color, color, wxTransparentColor));
wxChartsDefaultTheme->SetDatasetTheme(wxChartsDatasetId::CreateImplicitId(i),
wxSharedPtr<wxChartsDatasetTheme>(datasettheme));
I add following code, the issue was solved .it seems that the legend used the color from line theme,
wxChartsDefaultTheme->GetDatasetTheme(wxChartsDatasetId::CreateImplicitId(i))
->SetLineChartDatasetOptions(wxLineChartDatasetOptions(color, color, color));