I have around 7300 points to be plotted on a chart (Polar Chart to be precide). User requirement is that the Symbol size, color and shape should be options he choose.
I ended up using the FIllScenegraph event to draw custom symbols on the chart. The chart seems to be slow to render, and often has to wait for one minute or more. On top of that I need to add the options to display /hide these points which makes the control useless to the user.
Can I get better performance with a custom layer?
What is the best way to render primitives on a chart? If all I have to do once the primitive is on the chart is to change its color, is there a better way to handle this?
Appreciate some help.
Anil
I have submitted the sample solution and data file. Appreciate your help.
Hi,
I have created the following support ticket for you: CAS-55682-R1G1BR. Please send there your sample there so I can check it. As you might have tested too my colleagues code it renders within 2 seconds ( on my machine).
Regards,
Stefaniya
Max,
Thanks. Here is my code. This one at the moment take around 20-30 seconds to render.
Except for getting color from a color table based on property value, this should have rendered within the 2-5 seconds your code might be taking.
Also, when ever we move the mouse in and out of the screen, it forces a re-draw. Is there an efficient way to control this - rather than enabling/disabling the event.
-------------------------------------Code------------------------------------------------------------------
private void update_scene(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
{
foreach (Primitive primitive in e.SceneGraph)
PointSet pointSet = primitive as PointSet;
if (pointSet == null)
continue;
}
else
// Check if we need to display data points.
if (this.SymbolVisibility)
Color clr = Color.Aquamarine;
IChartData chartData = null;
SymbolIcon symbolshape = this.Symbol; // Based on user selection.
int newIconsize = 10;
foreach (DataPoint dataPoint in pointSet.points)
if (chartData == null) chartData = dataPoint.Layer.ChartData;
// Ignore points outside chart area.
if (dataPoint.point.X > -1)
// Get X,Y and property value from data
double dipval = chartData.GetValue(dataPoint.Row, 0);
double azimval = chartData.GetValue(dataPoint.Row, 1);
double propertyval = chartData.GetValue(dataPoint.Row, 2);
// Get color based on value from color table
clr = this.getSymbolColorForValue(propertyval);
// Set symbol size to what user has specified.
newIconsize = this.getSymbolSize(dipval);
Symbol symbol = new Symbol(dataPoint.point, symbolshape, (SymbolIconSize)newIconsize);
symbol.PE.Fill = clr;
symbol.PE.Stroke = clr;
symbol.PE.StrokeOpacity = 255;
// Set Z-order so that symbols are specified behind the mesh.
e.SceneGraph.Insert(3,symbol);
//this.UpdateChart = false;
break;
Using FillSceneGraph yields better performance than implementing a custom layer. I'm not sure why you're having such performance problems. When I try a polar chart with 10000 points and a custom symbol over each point, the chart takes about 2 seconds to render. Here's my sample:private void Form1_Load(object sender, EventArgs e){ DataTable dt = new DataTable(); dt.Columns.Add("col1", typeof(double)); dt.Columns.Add("col2", typeof(double));
for (int i = 0; i < 10000; i++) { dt.Rows.Add(new object[] { i, i }); }
ultraChart1.ChartType = ChartType.PolarChart; ultraChart1.PolarChart.ColumnX = 0; ultraChart1.PolarChart.ColumnY = 1; ultraChart1.PolarChart.ConnectWithLines = true; ultraChart1.PolarChart.Icon = SymbolIcon.None; ultraChart1.DataSource = dt;}
private void ultraChart1_FillSceneGraph_1(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e){ PointSet pointset = null;
foreach (Primitive p in e.SceneGraph) { if (p is PointSet) pointset = p as PointSet; }
if (pointset != null) { foreach (DataPoint point in pointset.points) { Symbol symbol = new Symbol(); symbol.icon = SymbolIcon.Circle; symbol.iconSize = SymbolIconSize.Small; symbol.point = point.point; e.SceneGraph.Add(symbol); } }}