Posted 2 November 2018, 11:40 am EST - Updated 4 October 2022, 2:01 am EST
C1Chart Win Conditionnal xyplot dot color
Posted by: earobitaille on 2 November 2018, 11:40 am EST
-
-
Posted 5 November 2018, 12:36 am EST
Hi,
Please find the answers to your questions below:
- You can use the C1Chart PointStyles to use the conditional coloring.
//In the PointStyle Select event handler double val = Convert.ToDouble(c1Chart1.ChartGroups[1].ChartData[e.SeriesIndex].Y[e.PointIndex]); C1.Win.C1Chart.PointStyle ps = (C1.Win.C1Chart.PointStyle)sender; ps.SymbolStyle.Color = val > 0 ? Color.Green : Color.Red; e.Selected = true;
To know more about PointStyles please refer to the following help file link:
http://help.grapecity.com/componentone/NetHelp/c1chart2d/webframe.html#workingwithpointstyl.html- To sync the Y and Y2 scale you can set the Min/Max values of both the axis as shown below:
var y1 = c1Chart1.ChartArea.AxisY; var y2 = c1Chart1.ChartArea.AxisY2; double y1Max = Convert.ToDouble(y1.GetMax()); double y2Max = Convert.ToDouble(y2.GetMax()); double y1Min = Convert.ToDouble(y1.GetMin()); double y2Min = Convert.ToDouble(y2.GetMin()); y1.Max = y2.Max = Math.Max(y1Max,y2Max); y1.Min = y2.Min= Math.Min(y1Min, y2Min);
Please refer to the attached sample for details.
Regards,
Ankit