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
icon size is based on an enum and cannot be set to a specific data value, so you're limited to using small-medium-large scheme. The workaround is to hide the icons completely and handle FillSceneGraph event and render custom shapes on top of each point.
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.
Max,
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 .
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; }}
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; }}