This is a migrated thread and some comments may be shown as answers.

[Solved] Auto-adjustment of the valueAxis after a web request

2 Answers 25 Views
Chart for HTML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Samuel
Top achievements
Rank 1
Samuel asked on 05 Feb 2013, 09:50 PM
Hello,

I tried to built a chart with a web request. The data loading and redrawing works fine, but I don't know, how to ajust the valueAxis automatically...

If I define the new max value of the axis, the axis adapts to this value, but I'd like to autoscale it...

chart.valueAxis.max = 150;
With the code above I can change the max value of the axis before redrawing... can I somehow get the max value of the series to set this value as the new max value of the axis? Is there a way to autoscale it?

Hint: without having defined the valueAxis before, the Axis is autoscaled... the definition of the valueAxis is as follow:

valueAxis: {
labels: {
     format: '{0}',
     skip: 2,
     step: 2
},
title: {
     text: 'EUR'
},
name: 'price',
color: '#000000',
majorGridLines: {
     color: '#cccccc',
     width: 1,
     visible: true
}
}

Thank you for your help and best regards!

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 06 Feb 2013, 12:31 PM
Hi Samuel,

Can you confirm if the issue is reproduced when you remove the name setting of the value axis? On my side I reproduced the descirbed behavior only when the axis name is set, but the series does not define an axis property, pointing to this name. For example:
<div id="chart1" data-win-control="Telerik.UI.RadChart" data-win-options="{
    dataSource: {
    pageSize: 4,
        transport: {
            read: {
                url: 'http://services.odata.org/Northwind/Northwind.svc/Products',
                dataType: 'json'
            }
        },
        schema: {
            data: 'd.results'
        }
    },
    series: [{
        type: 'column',
        field: 'UnitPrice',
    }],
    valueAxis: {
    labels: {
         format: '{0}',
         skip: 2,
         step: 2
    },
    title: {
         text: 'EUR'
    },
    name: 'price',
    color: '#000000',
    majorGridLines: {
         color: '#cccccc',
         width: 1,
         visible: true
    }
    }
 
}">
</div>

However, if I change the series definition like below, the value axis is auto-updated correctly:
series: [{
    type: 'column',
    field: 'UnitPrice',
    axis: 'price'
}]

Check if this is the case on your side and if so, either remove the name setting, or assign the name to the series.

If the issue persists, please share your entire chart definition, so we can test it locally.

Kind regards,
Tsvetina
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
Samuel
Top achievements
Rank 1
answered on 06 Feb 2013, 09:55 PM
Hy Tsvetina

Perfect! If I remove the name setting of the value axis, the autoscaling works fine after reloading. Thank you very much for your help and best regards!
Tags
Chart for HTML
Asked by
Samuel
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Samuel
Top achievements
Rank 1
Share this question
or