FlexChart - Multi Y-Axis Request

Posted by: alex.corti on 20 February 2024, 1:13 am EST

    • Post Options:
    • Link

    Posted 20 February 2024, 1:13 am EST

    Good morning,

    a client needs to show n Y axes as many series as are shown on the screen.

    Each Y-axis must have its own scale and a label identifying it.

    An additional request is to have the Y-axis of the same series color.

    Is this possible ?

    In the current solution (see image) the software shows only one Y-axis on both sides.

    Now it would like to see 6 on the left side: one for each series (CH4, CO … , NH3) each with its own scale, label and if possible with axis color equal to the color of the series.

    Thanks Alex

  • Posted 20 February 2024, 1:14 am EST - Updated 20 February 2024, 1:19 am EST

  • Posted 21 February 2024, 12:05 am EST

    Hello Alex,

    For each series you add, you can set a y-axis and color it by getting the palette color as follows:

    _chart.Series.Clear();
    for(int i=0; i<6; i++) //adding 6 series
    {
        _chart.Series.Add(new Series
        {
            Binding = $"Y{i + 1}",
            Name = $"Y{i + 1}",
            AxisY = new Axis
            {
                Position = C1.Chart.Position.Left,
                Style =
                {
                    StrokeColor = Color.FromArgb((int)(_chart as C1.Chart.IPalette).GetColor(i))
                }
            }
        });
    }


    Please refer to the attached sample for implementation. (see FlexChart_MultipleYAxis.zip)

    Regards,

    Uttkarsh.

  • Posted 21 February 2024, 12:43 am EST

    Thanks Uttkarsh,

    The example works so I will adapt it on my sw.

    Great job.

    Alex

  • Posted 21 February 2024, 4:20 pm EST

    Hello Alex,

    We are glad to know that the solution works for you.

    If you have any more queries or require any further assistance, please feel free to contact us.

    Regards,

    Uttkarsh.

Need extra support?

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

Learn More

Forum Channels