Under review
Keep LineSerie Colors
This discussion was imported from CodePlex
oloopy wrote at 2013-04-27 02:30:
Currently I am using OxyPlot to plot vehicle trajectory data. The total number of lines would be around 2000. OxyPlot does a good job to render these lines efficiently and give them a different color automatically.
But I noticed that colors of lines would be changed if I remove one of lines. And it seems like the color would be rearranged by default color order, which is from green, khaki, red...
For example, I plot three vehicle trajectories below.
(https://www.dropbox.com/s/xx2wygeoeg8sg4p/Screenshot_4_26_13_8_10_PM.png)
ID 2270 is in green. ID 2276 is in khaki. ID 2281 is in red. And the order I plot them is start from 2270, then 2276, finally 2281.
(https://www.dropbox.com/s/pw6ptb0a6w1cadp/Screenshot_4_26_13_8_13_PM.png)
Now I remove ID 2276. Then ID 2281's color changed to be khaki from red.
I would like to know if there is a way to keep the line color as it will help user focus on certain line they are working on.
Here lists my code. It's quite simple.
var lineSerie = new LineSeries();
data.ToList().ForEach(d =>lineSerie.Points.Add(new DataPoint(Convert.ToDouble(d.X), Convert.ToDouble(d.Y))));
plotModel.Series.Add(lineSerie);
viewModel.plotModel.RefreshPlot(true);
:)
Thank you guys!
But I noticed that colors of lines would be changed if I remove one of lines. And it seems like the color would be rearranged by default color order, which is from green, khaki, red...
For example, I plot three vehicle trajectories below.
(https://www.dropbox.com/s/xx2wygeoeg8sg4p/Screenshot_4_26_13_8_10_PM.png)
ID 2270 is in green. ID 2276 is in khaki. ID 2281 is in red. And the order I plot them is start from 2270, then 2276, finally 2281.
(https://www.dropbox.com/s/pw6ptb0a6w1cadp/Screenshot_4_26_13_8_13_PM.png)
Now I remove ID 2276. Then ID 2281's color changed to be khaki from red.
I would like to know if there is a way to keep the line color as it will help user focus on certain line they are working on.
Here lists my code. It's quite simple.
var lineSerie = new LineSeries();
data.ToList().ForEach(d =>lineSerie.Points.Add(new DataPoint(Convert.ToDouble(d.X), Convert.ToDouble(d.Y))));
plotModel.Series.Add(lineSerie);
viewModel.plotModel.RefreshPlot(true);
:)
Thank you guys!
objo wrote at 2013-04-29 13:28:
I think you should keep your own list of colours, and set the colour for each series manually!
I see that OxyPlot could assign the automatic colour only once, but this requires some changes to the code. Create an issue if you think this is an important feature to add!
I see that OxyPlot could assign the automatic colour only once, but this requires some changes to the code. Create an issue if you think this is an important feature to add!
objo wrote at 2013-04-29 13:30:
btw, what kind of vehicles are you plotting trajectories for? I am curious :)
Customer support service by UserEcho
From Here
Indentation needs to be fixed on it lol.
Yes, I can set series color in code and it won't be changed. I think if we let an user to show and hide series we should keep their colors.
In order to get the default behaviour it's also necessary to set a series linestyle.
My solution
I updated your code samples :-)