how to redefine the color theme of column chart?
rodingbao opened this issue · 5 comments
dear all:
I want to replace the defalut color theme of column chart
here is my code, it's success to define the wxChartsDatasetTheme, but fail when I update the wxChartsDefaultTheme.
can anyone comment or help improving?
wxVector<double> t_points;
for (size_t i = 0; i < points.size(); i++) {
t_points.assign(points[i].begin(), points[i].end());
wxChartsDatasetTheme *datasettheme = new wxChartsDatasetTheme();
datasettheme->SetColumnChartDatasetOptions(wxColumnChartDatasetOptions(
wxChartsPenOptions(wxColour(COLOR[i]), 2),
wxChartsBrushOptions(wxColour(COLOR[i]))));
wxChartsDefaultTheme->SetDatasetTheme(
wxChartsDatasetId::CreateImplicitId(i),
wxSharedPtr<wxChartsDatasetTheme>(datasettheme));
wxChartsDoubleDataset::ptr dataset(
new wxChartsDoubleDataset(seriesName[i], t_points));
chartData->AddDataset(dataset);
}
Best regards
BZG
What exactly doesn't work? Your code produce compile error, runtime error, silently doesn't work as expected?
First of all do it outside the loop, like I'd showed in this issue - #165
compile error, message as below. C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/10.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../build-Release/family/main.cpp.o:main.cpp:(.rdata$.refptr.wxChartsDefaultTheme[.refptr.wxChartsDefaultTheme]+0x0): undefined reference to `wxChartsDefaultTheme'
Re-check that you're using correct version of the library
I download source code (master branch,https://codeload.github.com/wxIshiko/wxCharts/zip/refs/heads/main) from git, and complier the lib by myself, do you mean that my download link is incorrect?
when I link with the static lib, the error disappered. dont know what happend. just close the issue.