Thanks for the info. Does this also work on version 6.3? I notice that there is no Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs with my version.
Also, the current code we have uses poinset primitives. When you say I need to add symbols on top, does that mean override the pointsets???
I am using a ChartLayer class which implements the ILayer class, and in there I have a FillSceneGraph(SceneGraph scene) method (this is legacy code which I did not write, see below):
How would I implement different colours depending on the strategyId???
public void FillSceneGraph(SceneGraph scene)
{
ChartData chart = (ChartData)((Control)ChartComponent).Tag;
IDictionary pointSetData = chart.PointSetData;if (pointSetData == null)
{
foreach (Primitive p in scene)
{
PointSet points = p as PointSet;
if (points != null)
{
int counter = GetRow(points);if (counter == 0)
{
points.drawColor = Color.LimeGreen;
points.fillColor =
Color.LimeGreen;points.icon = SymbolIcon.X;points.iconSize = SymbolIconSize.Large;
}
else if (counter == 1)
{
points.drawColor =
Color.Blue;points.fillColor = Color.Blue;
points.icon =
SymbolIcon.Triangle;points.iconSize = SymbolIconSize.Medium;
}
else if (counter == 2)
{
points.drawColor = Color.Red;
points.fillColor =
Color.Red;points.icon = SymbolIcon.Diamond;points.iconSize = SymbolIconSize.Medium;
}
else
{
points.drawColor = Color.Yellow;
points.fillColor =
Color.Yellow;points.icon = SymbolIcon.Circle;points.iconSize = SymbolIconSize.Medium;
}
}
}
}
else
{
ArrayList newItems = new ArrayList();foreach (Primitive p in scene)
{
PointSet points = p as PointSet;if (points != null)
{
// Use pointSetDataint counter = GetRow(points);if (counter == 0)
{
// special casepoints.drawColor = Color.LimeGreen;
points.fillColor =
Color.LimeGreen;points.icon = SymbolIcon.X;
points.iconSize =
SymbolIconSize.Large;continue;
}
PointInfo pi = pointSetData[counter] as PointInfo;if (pi != null)
{
short styleId = model.AnalysisModel.ChartProvider.StyleId(counter);short strategyId = model.AnalysisModel.ChartProvider.StrategyId(counter);
points.drawColor = GetStrategyColor(strategyId);
points.fillColor = GetStrategyColor(strategyId);
points.icon = ChartDataHelper.GetStyleIcon(styleId);
points.iconSize =
SymbolIconSize.Medium;}
else
{
points.drawColor = Color.Pink;
points.fillColor =
Color.Pink;points.icon = SymbolIcon.Character;
points.character =
'#';points.iconSize = SymbolIconSize.Medium;
}
// Make different color around an iconif (points.icon != SymbolIcon.Plus)points.drawColor = Color.Black;
// Add labelsif (showLabels)
{
foreach (Primitive dp in points.GetPrimitives())
{
DataPoint dataP = dp as DataPoint;if (null != dataP)
{
Point pnt = dataP.point;
pnt.Offset(3, -3);
string label = model.GetDataPointLabel(dataP.Row);if (dataP.Row != 0)
{
short strategyId = model.AnalysisModel.ChartProvider.StrategyId(dataP.Row);
dataP.PE.Fill = GetStrategyColor(strategyId);
dataP.drawColor = GetStrategyColor(strategyId);
}
FontStyle fontStyle = FontStyle.Regular;Color fontColor = Color.Black;if (-1 != label.IndexOf(" [NOTE: "))
{
fontColor = Color.Red;label = label.Substring(0, label.IndexOf(" [NOTE: "));
}
Text text = new Text(pnt, label, new LabelStyle());text.labelStyle.Font = new Font(text.labelStyle.Font.FontFamily, 7, fontStyle, GraphicsUnit.Point);
text.labelStyle.FontColor = fontColor;
text.DataPoint = (IDataPoint)dataP;
newItems.Add(text);
}
}
}
}
}
// Now add those new itemsforeach (Text t in newItems)
{
scene.Add(t);
}
}
}
Thanks