Remove decimals from yAxis

4 posts, 1 answers
  1. Kim
    Kim avatar
    10 posts
    Member since:
    Oct 2013

    Posted 25 Oct 2013 Link to this post

    Hi Telerik Team,

    We are using rad chart for drawing Bar and Line Series graphs.
    When the Y axis value is 1 or 2 the Y axis shows decimal points. Need to eliminate the decimal points. Please refer the screen shot.
    At any point of time my Y axis should not contain the decimal, as our result data will not have such decimal data.

    Thanks and regards.
  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 30 Oct 2013 Link to this post

    Hello Kim,

    You can set the AutoScale property of YAxis to false and then set an integer value for the Step of the YAxis. For example:
    <telerik:RadChart ID="RadChart1" runat="server">
        <PlotArea>
            <XAxis MaxValue="5" MinValue="1" Step="1">
            </XAxis>
            <YAxis MaxValue="4" Step="1" AxisMode="Extended" AutoScale="false">
                <Appearance></Appearance>
            </YAxis>
        </PlotArea>
        <Series>
            <telerik:ChartSeries Name="Series 1">
                <Appearance>
                    <FillStyle MainColor="Red">
                    </FillStyle>
                </Appearance>
                <Items>
                    <telerik:ChartSeriesItem YValue="1" Name="Item 1">
                    </telerik:ChartSeriesItem>
                    <telerik:ChartSeriesItem YValue="2" Name="Item 2">
                    </telerik:ChartSeriesItem>
                    <telerik:ChartSeriesItem YValue="1" Name="Item 3">
                    </telerik:ChartSeriesItem>
                    <telerik:ChartSeriesItem YValue="3" Name="Item 4">
                    </telerik:ChartSeriesItem>
                    <telerik:ChartSeriesItem YValue="2" Name="Item 5">
                    </telerik:ChartSeriesItem>
                </Items>
            </telerik:ChartSeries>
        </Series>
    </telerik:RadChart>



    Regards,
    Danail Vasilev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kim
    Kim avatar
    10 posts
    Member since:
    Oct 2013

    Posted 30 Oct 2013 Link to this post

    unfortunately YAxis dont have a property called AutoScale, so i cant set it to false..

    We are using RadHTMLChart, and not the RadChart. maybe thats got something to do with also.

    We would like to have the options to change the margin for columns and the width aswell. If i understand correctly its not possible to change the width.
  5. Answer
    Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 01 Nov 2013 Link to this post

    Hi Kim,

    Thank you for the clarification.

    You can use the Step property of the XAxis in order to control units through which the grid lines will be plotted and the Step property of the XAxis' LabelsAppearance element in order to control the step of the rendered labels. For example:

    ASPX:
    <YAxis Step="1">
        <LabelsAppearance Step="2"></LabelsAppearance>
    </YAxis>

    Regarding the control of the gap/spacing between the bar/columns in the current version of RadControls this functionality is not supported. However, such a feature request has already been logged in our feedback portal here, so that you can monitor, comment or raise the priority of this item.

    For the time being the mentioned properties can be set on the client through the chartObject of the RadHtmlChart:

    JavaScript:
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function ChangeSpace() {
                var chart = $find("<%=ColumnChart.ClientID%>");
                chart._chartObject.options.series[0].spacing = 0.9;
                chart.repaint();
            }
     
            function ChangeGap() {
                var chart = $find("<%=ColumnChart.ClientID%>");
                chart._chartObject.options.series[0].gap = 10;
                chart.repaint();
            }
        </script>
    </telerik:RadCodeBlock>

    ASPX:
    <telerik:RadButton ID="RadButton1" runat="server" AutoPostBack="false" Text="Change Space" OnClientClicked="ChangeSpace" />
    <telerik:RadButton ID="RadButton2" runat="server" AutoPostBack="false" Text="Change Gap" OnClientClicked="ChangeGap" />
    <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Transitions="true">
        ....
    </telerik:RadHtmlChart>


    Regards,
    Danail Vasilev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top