Wpf Chart Series Symbol in FastScatter
I am using Scatter chart to display multiple chart series in a WPF chart. I need to use different symbols for each data series (e.g. square, circle). I can achieve this using data templates similar to the one below:
In my application, the number of data points is in the order of thousands, and they update in realtime. I noticed that using FastScatter gives me a good enough performance. However, data templating is not supported in FastScatter type.
Is there a way to achieve this: use different symbols/colors for each data series and have a good performance like that of FastScatter?
Besiana
Hi Besiana,
Thanks for using Syncfusion Products.
We have analyzed your reported query and you can use FastScatter Chart Data Template by overriding FastScatterPresenter class.
And we can achieve your requirement by drawing different symbols using DrawingContext as shown in the given code snippet.
Code Snippet[C#]:
using (DrawingContext context = visual.RenderOpen())
{
foreach (var pt in pp)
{
visual.Index = i;
context.DrawEllipse(br, pn, pt,width ,height); //We can able to draw differend symbol
i++;
}
}
We have prepared the sample based on your requirement. Please download it from the given location.
Please let us know if you have any queries.
Regards,
M.Sheik Syed Abthaheer
FastScatterTemplate_fdc95dd2.zip
I am trying to determine the shape/color of the symbol based on some property of the data point. Code snippet below:
This is not giving me the right X values. Is there something wrong with the following lines:
Any idea how I can do this properly?
Kind regards,
Besiana
Hi Besiana,
Thanks for your update.
There is no need to calculate new points in FastScatter Presenter. We can able to get points from PointCollection based on DataPoint index as shown in the given below code snippet.
Code snippet[C#]:
|
PointCollection pp = Points; using (DrawingContext context = visual.RenderOpen()) { for (var index = 0; index < data.Count; index++) { var dataPoint = data[index]; var car = (ExpensiveCar)dataPoint.Tag; var p = pp[index]; if (car.CarName.StartsWith("Ultimate")) { context.DrawEllipse(br,pn,p, 10, 10); } else { //drawing other symbol } } } |
We have prepared the sample based on your requirement. Please download it from the below location.
Please let us know if you have any queries.
Regards,
M. Sheik Syed Abthaheer
FastScatterTemplate (2)_73cdba9.zip
I am trying something like the following:
Any idea how I can achieve this?
Regards,
Besiana
Hi Besiana,
Thanks for your update.
You can achieve your requirement by applying Tootip property in Fastscatter chart Template as shown in the given code snippet
Code snippet [Xaml]:
|
<DataTemplate x:Key="fastscatter"> <local:FastScatter Points="{Binding Points}" Series="{Binding Series}" ToolTip="{Binding ToolTip}" /> </DataTemplate> |
Please let us know if you have any queries.
Regards,
M. Sheik Syed Abthaheer
Besiana
Hi Besiana,
Thanks for your update.
We would like to inform you that, we cannot bind ToolTip value based on Datapoint values. Because we draw the FastScatter chart as a single segment.
However we can achieve your requirement (getting tooltip value based on Datavalue) through the workaround manner.
We have prepared the sample based on your requirement. Please download it from the given location.
Please let us know if you have any queries.
Regards,
M. Sheik Syed Abthaheer
FastScatterTooltipDemo_966ae9d8.zip
- 7 Replies
- 2 Participants
-
BE Besiana
- Mar 30, 2013 12:36 AM UTC
- Apr 4, 2013 11:10 AM UTC