-
Notifications
You must be signed in to change notification settings - Fork 981
Description
ScottPlot Version: ScottPlot.WPF 4.1.67
Operating System: Windows
Application Type: WPF
Question:
Hi,
Me and the team I work with, have recently started using ScottPlot in the software that we write, and it's amazing how quick and easy it is to get a plot rendering, using your library.
There's a slight limitation I've noticed, when using the PopulationMultiSeries, where it appears that we ignore the alpha channel of the colours passed in, when we draw the boxes, I think we preserve transparency for the scatter points, (that we can optionally draw).
Following a strict colour palette is quite important for our software, is there any way with the current library, to set the colours of the boxes and the points, to a collection of colours that we'd like to use, where these colours may/may not contain transparency?
I've provided a small snippet of code, showing how I am creating the PopulationMultiSeries, and a screenshot of the rendered plot.
Ideally, we'd like to control the colours of the boxes and the points, but I am unsure if this can be done?
Thanks for your help,
Emma
public void CreatePopulationMultiSeries(WpfPlot plot)
{
plot.Plot.Title("Plot title");
plot.Plot.Legend();
var seriesColours = new Color[] { Color.FromArgb(100, 255, 0, 0), Color.Blue, Color.Green };
var groupNames = new[] { "Group A", "Group B", "Group C" };
var seriesData = new[]
{
new[]
{
new []{1.0, 2.0, 3.0},
new []{2.0, 3.0, 4.0},
new []{5.0, 6.0, 7.0}
},
new[]
{
new []{8.0, 9.0, 10.0},
new []{11.0, 12.0, 13.0},
new []{14.0, 15.0, 16.0}
}
};
// Setup the X axis ticks
plot.Plot.XTicks(groupNames);
var populations = seriesData.Select(series => series.Select(seriesData => new Population(seriesData)).ToArray()).ToArray();
var populationSeries = populations.Select((p, i) => new PopulationSeries(p, seriesLabel: $"Series {i}")).ToArray();
var populationMultiSeries = new PopulationMultiSeries(populationSeries.ToArray());
var populationPlot = plot.Plot.AddPopulations(populationMultiSeries);
// Set the colours
for (var i = 0; i < populationPlot.MultiSeries.seriesCount; i++)
{
populationPlot.MultiSeries.multiSeries[i].color = seriesColours[i];
}
plot.Refresh();
}<WpfPlot x:Name="PlotName" />