ChartView - events differs between resize and fullscreen

1 Answer 28 Views
ChartView
Fabrice
Top achievements
Rank 2
Iron
Fabrice asked on 03 Nov 2023, 05:04 PM

Hi,

 

I’m trying to draw CartesianGridLineAnnotation in front of each Y axis tick.

 

The Y axis number of ticks depends on the size of the RadChartView. The property DesiredTickCount is update into the SizeChanged event of the Chart. (Same issue with the resize event of the RadChartView).

 

It’s working fine when the form is resize with the mouse drag, but when I resize the form by double clicking the form (switch to full screen), it’s not working as expected.

 

ActualRange property seems not updated in the non working case, is there a way to avoid that ?

 

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Nadya | Tech Support Engineer
Telerik team
answered on 06 Nov 2023, 01:32 PM

Hello, Fabrice,

The provided project is greatly appreciated.

It seems the chart needs to be updated when you initialize the annotations anew. I am using the Update method in order to update the chart and calculate its ActualRange again. I have also modified a little the UpdateTickGraph() by specifying the Maximum of the LinearAxis according to DesiredTickCount.

{
    var axeY = GetOrdonnee();

    if (axeY == null)
        return;

    var hauteurGraphique = sChartView.ChartElement.Wrapper.Size.Height - 100;

    if (hauteurGraphique < 200)
        axeY.DesiredTickCount = 4;
    else if (hauteurGraphique < 400)
    {
        axeY.DesiredTickCount = 5;
        axeY.Maximum = 5;
    }
    else if (hauteurGraphique < 600)
    {
        axeY.DesiredTickCount = 6;
        axeY.Maximum = 6;
    }
    else if (hauteurGraphique < 800)
    {
        axeY.DesiredTickCount = 7;
        axeY.Maximum = 7;
    }

    else if (hauteurGraphique > 800)
    { 
    axeY.DesiredTickCount = 8;
    axeY.Maximum = 8;
}

I attached the modified project for your reference. It is working as expected now on my side when double click on the form to resize the form, the chart is also updating, and its annotations recreate. Can you give it a try and let me know how it works for you.

I hope this helps. Let me know if I can assist you further.

Regards,
Nadya
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Fabrice
Top achievements
Rank 2
Iron
commented on 06 Nov 2023, 03:43 PM

This is working as expected!

Thanks

Tags
ChartView
Asked by
Fabrice
Top achievements
Rank 2
Iron
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or