SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
Hello,
I’m trying to get a scatter series chart to work but it doesn’t render. For Bar, Impulse, and Line I can use the same code only switching the series type, but when I attempt to do the same with Scatter series (both XyScatter and ExtremeScatter) the points don’t render.
Here is my scatter series code:
// ...
for (int i = 0; i < dimensions; i++)
{
var scatterSeries = new ExtremeScatterRenderableSeries()
{
PointMarker = new EllipsePointMarker() { Width = 7, Height = 7}
};
scatterSeries.PaletteProvider = new ExtremeScatterPaletteProvider(colors);
Binding DataSeriesBinding = new Binding("Data");
DataSeriesBinding.Source = (_cvm as ChartViewModelXY).ndData.ElementAt(i);
scatterSeries.SetBinding(BaseRenderableSeries.DataSeriesProperty, DataSeriesBinding);
Chart.RenderableSeries.Add(scatterSeries);
permanentLineSeries++;
}
// ...
public class ExtremeScatterPaletteProvider : IExtremePointMarkerPaletteProvider
{
private readonly List<Color> _dataPointColors;
private readonly Values<Color> _colors = new Values<Color>();
public ExtremeScatterPaletteProvider(List<Color> dataPointColors)
{
_dataPointColors = dataPointColors;
}
// Fill Colors for each data-point index
public Values<Color> Colors { get { return _colors; } }
public void OnBeginSeriesDraw(IRenderableSeries rSeries)
{
var indexes = rSeries.CurrentRenderPassData.PointSeries.Indexes;
var count = indexes.Count;
_colors.Count = count;
// copy required colors from list using data point indices
for (int i = 0; i < count; i++)
{
var dataPointIndex = indexes[i];
_colors[i] = _dataPointColors[dataPointIndex];
}
}
}
The same code works with 3 other XY charts, so I’m fairly certain the issue is with how I am creating the ExtremeScatter. Any help or insight would be greatly appreciated!
Edit: For anyone curious / googling a fully instantiated XyScatterRenderableSeries in code looks like this:
// Render a scatter series
var scatterSeries = new XyScatterRenderableSeries()
{
PointMarker = new EllipsePointMarker() { Width = 7, Height = 7, Stroke = colors[i], Fill = colors[i]}
};
That will render the series with the same color for both the border and interior.
ExtremeScatterRenderableSeries is a feature available in the SDK Professional, SDK Enterprise and SciChart WPF 2D Enterprise editions only.
We have another scatter series though called the XyScatterRenderableSeries which will work with your edition (SciChart WPF 2D Professional)
Best regards,
Andrew
Please login first to submit.