C1Chart Win Conditionnal xyplot dot color

Posted by: earobitaille on 2 November 2018, 11:40 am EST

    • Post Options:
    • Link

    Posted 2 November 2018, 11:40 am EST - Updated 4 October 2022, 2:01 am EST

    I Have 2 questions

    1 - Is there a way to change the symbol color of each dot depending on a condition. See the picture for an example

    2 - Is there a way to sync the Y Scale and the Y2 Scale when set to Auto

  • Posted 5 November 2018, 12:36 am EST

    Hi,

    Please find the answers to your questions below:

    1. 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

    1. 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

    C1ChartPointStyles.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels