Stretching Y-Axis Box

4 posts, 0 answers
  1. Maciej
    Maciej avatar
    14 posts
    Member since:
    Aug 2013

    Posted 13 Aug 2015 Link to this post

    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

  2. Stamo Gochev
    Admin
    Stamo Gochev avatar
    157 posts

    Posted 18 Aug 2015 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Maciej
    Maciej avatar
    14 posts
    Member since:
    Aug 2013

    Posted 18 Aug 2015 in reply to Stamo Gochev Link to this post

    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

     

  5. Stamo Gochev
    Admin
    Stamo Gochev avatar
    157 posts

    Posted 21 Aug 2015 Link to this post

    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
Back to Top