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

Remove decimals from yAxis

4 Answers 134 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Kim
Top achievements
Rank 1
Kim asked on 25 Oct 2013, 01:20 PM
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.

4 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 30 Oct 2013, 09:32 AM
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.
0
Kim
Top achievements
Rank 1
answered on 30 Oct 2013, 09:53 AM
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.
0
Accepted
Danail Vasilev
Telerik team
answered on 01 Nov 2013, 05:24 PM
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.
0
Al
Top achievements
Rank 1
Iron
Iron
Iron
answered on 26 Jan 2017, 02:44 PM

I found that using

<YAxis Step="1">

Caused the auto-scale to be a problem when the chart has values >50. I found that using this worked much better:

<YAxis MajorTickSize="1">

 

Tags
Chart (HTML5)
Asked by
Kim
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Kim
Top achievements
Rank 1
Al
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or