Is there a way I can specify or draw a custom size symbol - size varies from say 1 to 10?
When I look at the posts, it looks like the SymbolIconSize is restricted to a predefined set of sizes - Large, Medium, Small etc..
you can technically set a size other than Large, Medium, Small:
this.ultraChart1.ScatterChart.IconSize = (SymbolIconSize)80;
but I'm unsure if you will run into any issues by stepping out of bounds in this regard as I'm not certain this was intended to be allowed.
-Graham
That works great.
Stretching that a little more, how can we set size for individual data points based on some data value?
Thanks
Anil
Ah, i guess I ran ahead of myself, as you can set the size of an icon. But in doing so, you are setting the icon size on the group of points, not on individual points. Another workaround would be to create a series for each point, so that you have groups of 1 data point. Then, you can set icons on each series, effectively controlling the icon on each data point.
Max,
Interesting. This is exactly what I wanted, but not sure if I can create a series for each point in Polar chart.
This approach won't work if you have the points connect to each other with a line. Polar chart points are typically connected. I think you're better off setting icon to None and overlaying a Symbol on top of each point inside FillSceneGraph event.
Not so clean, still this code worked with some issues:
1. How do I get the x,y coord of the chart from the datapoint.point? The idea is to increase the size of points from center to the edge by 1 point, though in my sample code, I am just specifying some random size to see wheher it works.
2. How to give the Symbol outline the same color as fill. Right now, the border/outline of the symbol
is dark (is it black?)
3. Color remained the same for all points. I would like to give a range of colors.
-----------------------------here is my sample code from FillSceneGraph event----------------------------------
foreach (Primitive primitive in e.SceneGraph){ PointSet pointSet = primitive as PointSet;
if (pointSet == null) { continue; } else { int iconsize = 3; for (int k = 0; k < pointSet.points.Length; k++) { DataPoint dataPoint = pointSet.points[k]; Symbol symbol = new Symbol(dataPoint.point, SymbolIcon.Diamond, (SymbolIconSize)iconsize); Color clr = Color.FromArgb(100,(225+iconsize),(130+iconsize*3),(76+iconsize*5)); symbol.PE.Fill = clr; e.SceneGraph.Add(symbol); iconsize = iconsize +2; if (iconsize > 20) iconsize = 3; } break; }}
using dataPoint.point already gives you the chart coordinates. If you want to map those coordinates on x or y axis, use axis mapping functions:IAdvanceAxis xAxis = (IAdvanceAxis)e.Grid["X"];xAxis.Map(dataPoint.point.X);
For symbol outline use PE.Stroke.
Here's a code snippet that sets a range of colors:IAdvanceAxis xAxis = (IAdvanceAxis)e.Grid["X"];IAdvanceAxis yAxis = (IAdvanceAxis)e.Grid["Y"];
Color[] colors = { Color.Red, Color.Blue, Color.Green, Color.Yellow, Color.Violet, Color.Brown };foreach (Primitive primitive in e.SceneGraph){ PointSet pointSet = primitive as PointSet;
if (pointSet == null) { continue; } else { int iconsize = 3; for (int k = 0; k < pointSet.points.Length; k++) { DataPoint dataPoint = pointSet.points[k]; Symbol symbol = new Symbol(dataPoint.point, SymbolIcon.Diamond, (SymbolIconSize)iconsize); Color clr = colors[k % colors.Length]; symbol.PE.Fill = clr; symbol.PE.Stroke = clr; e.SceneGraph.Add(symbol); iconsize = iconsize + 2; if (iconsize > 20) iconsize = 3; } break; }}
Thanks Max.
Not sure why you're getting points in the negative space. Could be due to zooming or a custom range, but I don't think there'll be problems if you get the data from the chart layer, like you did.
Couple of points here.
1. From dataPoint.point I get the screen coordinates. While most values were +ve, I got some weird long -ve values (eg : -276253) and they still belonged to the PolarLayer. These values can not be mapped to the polar chart coordinates.
2. I can get the x, y and any other column value from the datasource I specified by :
int
rowid = dataPoint.Row;
double dipval = dataPoint.Layer.ChartData.GetValue(rowid, 0);
double azimval = dataPoint.Layer.ChartData.GetValue(rowid, 1);
double propertyval = dataPoint.Layer.ChartData.GetValue(rowid, 2);
and it works great.
Now the question is, will there be a situation when the abovve statements can go wrong.
3. Thanks for helping me with the symbol stroke - that worked
4. Colors, works with simple rgb values, but I may have to go for more complex models. I will have to come back with more questions .