-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Legend for StackedColumnChart #166
Comments
It's similar but a bit more tricky. wxChartsLegendCtrl doesn't have own theme it's only use theme from wxLineChartCtrl.
|
I'm getting the same shared pointer error that I got on the previous issue. The chartData has 1 categorical data sets and 5 double datasets so I set nDatasets = 7 and I get the shared pointer error. I tried setting nDatasets to 8 and the app closed on execcution. ` wxChartsDatasetTheme* datasettheme = new wxChartsDatasetTheme();
int i,j;
// Create the legend widget
} |
nDatasets is 5 in your case because you have 5 values on legend. You got shared pointer error because you created chart before updating theme. |
Thanks again for all your help. Worked like a charm. One last question is there a way to specify colors by rbg values? |
Yes, just use wxColour object:
|
I think the LineChartDatasetOptions stays in memory. If I build it after rebooting it executes and makes the changes fine. But if I rebuild it again it dies on execution. If I then drop your linechart loop out and recompile on execution it runs but without the changes the loop makes. Then if I recompile again with the loop in it makes the changes and looks fine |
Yeah I added event.Skip(); at the end and it all works fine. Thanks for your help and patienc.e |
In the stacked bars the first data set is at the bottom of the bar but it's at the top of the legend. Is there a way to reverse the order of the legend so that the first data set is at the bottom of the legend so that the order of the legend matches the order on the bars? |
You can construct data for legend in any order, just put them in separate wxVector and pass to the wxChartsLegendData constructor instead of |
So I added the data set to a new data set in reverse order of the data used to make the chart: ` // Create the legend widget
but the colors in the legend are still in the same order though the names are in the correct order. I need to flip the order of the colors in the legend. |
Right it won't work. As we "transfer" colors from StackedColumnChartDataset (main chart) into LineChartDataset(legend) in usual order (0-0, 1-1, ...) so for flipping we should do it in reverse order (0-nDatasets-1, 1 - nDatasets-2,...).
|
Got it thanks |
When I add a legend to my stacked column chart it only uses the 2 default colors. I assume there is a default theme similar to my previous issue that needs to be modified.
The text was updated successfully, but these errors were encountered: