FlexChart: Perfomance issue with Axis Label

Posted by: hdle on 27 November 2024, 3:22 pm EST

    • Post Options:
    • Link

    Posted 27 November 2024, 3:22 pm EST

    Hi,

    There seems to be a performance issue when showing axis label for many points and series. I have a chart that has 2000 point and 24 series. If I set AxisX labels for each point then the chart rendering and scrolling is extremely slow. If I reduce the number of series to 1-3, then its better. If I don’t set the label (keeping all series), then its fine. There something with setting labels and a lot of series that is the issue.

    Do you have any insight into this?

    Thanks,

    Hai

  • Posted 28 November 2024, 5:56 am EST

    Hello Hai,

    Calculating the bounds for a DataLabel includes complex calculations. So, it takes time to render 24*2000 labels at once.

    As a workaround, you can display the labels only after the AxisScrollBar is added to the chart and use the mouse events on the AxisScrollBar’s range slider to display labels only when the user has scrolled the chart as follows:

    //x - axis scrollbar
    AxisScrollbar scroll = null!;
    _chart.Rendering += (sender, e) =>
    {
        if(scroll == null)
        {
            scroll = new AxisScrollbar(_chart.AxisX)
            {
                UpperValue = 20
            };
    
            //Workaround
            new Task(async () =>
            {
                await Task.Delay(1);
                _chart.DataLabel.Position = C1.Chart.LabelPosition.Top;
            }).RunSynchronously();
            var down = false;
    
            scroll.Controls[0].MouseDown += (s, ev) =>
            {
                down = true;
            };
            scroll.Controls[0].MouseMove += (s, ev) =>
            {
                if (down)
                    _chart.DataLabel.Position = C1.Chart.LabelPosition.None;
            };
            scroll.Controls[0].MouseUp += (s, ev) =>
            {
                _chart.DataLabel.Position = C1.Chart.LabelPosition.Top;
                down = false;
            };
        }
    };

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

    Regards,

    Uttkarsh.

  • Posted 28 November 2024, 12:29 pm EST

    Hello Uttkarsh,

    Thank you for your prompt reply. I was probably not clear in my description, but the issue is with the axis label itself, not the point label. I used your example and added “Point X” as the axis label to demonstrate the issue.

    Thanks,

    Hai

    FlexChart_Sample_AxisLabels.zip

  • Posted 29 November 2024, 5:22 am EST - Updated 29 November 2024, 5:27 am EST

    Hello Hai,

    We tried to run the modified sample by removing the point labels but could not observe any performance issues. Please refer to the attached GIF and sample.

    GIF: https://drive.mescius.io/download?file=ExternalShare/WinForms/FlexChart_PerformanceGIF.zip

    Sample:

    FlexChart_Sample_AxisLabels_Mod.zip

    Could you please share a GIF showing the performance issue along with your machine’s environment and hardware details?

    Our machine’s details:

    Regards,

    Uttkarsh.

  • Posted 2 December 2024, 1:09 pm EST

    Uttkarsh,

    After seeing your example and digging further, it looks like the issue is on my end. Will investigate further.

    Thanks,

    Hai

  • Posted 2 December 2024, 4:07 pm EST

    I found it, the issue. It actually was between my computer chair and the keyboard :slight_smile:

    Thanks for your help.

    Hai

Need extra support?

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

Learn More

Forum Channels