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

Stretching Y-Axis Box

3 Answers 5 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Maciej
Top achievements
Rank 1
Maciej asked on 13 Aug 2015, 10:11 AM

Hi

I've got 3 RadHtmlCharts one below the other. The​y have different value range f.e. Chart1 from -9 to 5 and Chart2 from -100000 to + 100000. That causes the situation shown on picture, that they are placed not in line. I've already tried to adjust it in JS, but didn't manage to.

My code (I've tried many combinations):

var chart = $find("<%=timeChart.ClientID%>");

chart.get_kendoWidget()._plotArea.axisY.box.expand(50,50);

chart.get_kendoWidget()._plotArea.axisY.box.​pad(50);​

chart.get_kendoWidget()._plotArea.axisY.box.x2 = 150;

chart.repaint();

chart.get_kendoWidget().redraw();

chart.get_kendoWidget()​​.refresh();

 

None of this have worked.

I'm looking forward for your help

Greets,

Maciek

3 Answers, 1 is accepted

Sort by
0
Stamo Gochev
Telerik team
answered on 18 Aug 2015, 06:55 AM
Hi Maciej,

You can use the Margin property of LabelsAppearance to manually set the proper offset, so that the two charts look "aligned":
<YAxis>
    <LabelsAppearance>
        <TextStyle Margin="10px" />
    </LabelsAppearance>
</YAxis>
Of course, you can apply this customization to other elements (such as the chart title) depending on your requirements.

Regards,
Stamo Gochev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Maciej
Top achievements
Rank 1
answered on 18 Aug 2015, 07:49 AM

Thanks for your answer Stamo,

the thing is that I need to make it client-side, beacuse that's the only way to compute how many pixels I need to add. Do you know how can I achieve it ?

 

Maciek

 

0
Stamo Gochev
Telerik team
answered on 21 Aug 2015, 06:42 AM
Hello Maciej,

After you have manually calculated the proper value for the margin property, you can set it using JavaScript like this:
<script type="text/javascript">
    function setMargin() {
        var chart = $find("Chart");
        var widget = chart.get_kendoWidget();
 
        widget.options.valueAxis.labels.margin = 10;
 
        chart.repaint();
    }
</script>
I recommend you to have a look at this help resource for additional information regarding this customization.

Regards,
Stamo Gochev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart (HTML5)
Asked by
Maciej
Top achievements
Rank 1
Answers by
Stamo Gochev
Telerik team
Maciej
Top achievements
Rank 1
Share this question
or