Ability to add X and Y Axis Ranges but display all data on chart

Thread is closed for posting
6 posts, 0 answers
  1. R
    R avatar
    3 posts
    Member since:
    Oct 2011

    Posted 05 Oct 2011 Link to this post

    I'm trying to plot a series of data on a telerik:RadChart! the chart has 30 items with a data value range from 0 to 30. This works great as in image 1. What I'm trying to achieve is to be able to set the X and Y axis labels in ranges as in image 2, when i try and do this not all the charts are plotted in the plot area of the chart. What I'm trying to achieve is something like image 3 is this possible?
  2. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 10 Oct 2011 Link to this post

    Hello R,

    The Step property of the XAxis indicates that one out of n Ticks will be visible where the n is the value set to the Step property. This means that increasing the Step of the XAxis you are providing smaller range for your Points to be plotted.
    What I can suggest is that you set the LabelStep property of the XAxis to 10 and custom Range where the Step is 1. For example:

    RadChart1.PlotArea.XAxis.AutoScale = false;
    RadChart1.PlotArea.XAxis.AddRange(0, 30, 1);
    RadChart1.PlotArea.XAxis[0].TextBlock.Text = "0 - 10";
    RadChart1.PlotArea.XAxis[10].TextBlock.Text = "11 - 20";
    RadChart1.PlotArea.XAxis[20].TextBlock.Text = "21 - 30";
    RadChart1.PlotArea.XAxis.LabelStep = 10;

    Greetings,
    Evgenia
    the Telerik team
    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 their blog feed now
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. R
    R avatar
    3 posts
    Member since:
    Oct 2011

    Posted 10 Oct 2011 Link to this post

    Hi Evgenia, Thank you for your response, that worked and displays all the points on the graph and range labels, but is it possible to position the labels on the axis and show in the attached image.
  5. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 11 Oct 2011 Link to this post

    Hi R,

    To have the Axis Labels plotted as in your sample image you should increase their Left margin as shown here:
    RadChart1.PlotArea.XAxis.Appearance.TextAppearance.Dimensions.Margins.Left = new Telerik.Charting.Styles.Unit(110);

    Please feel free to customize the value per your own needs.

    Greetings,
    Evgenia
    the Telerik team
    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 their blog feed now
  6. R
    R avatar
    3 posts
    Member since:
    Oct 2011

    Posted 11 Oct 2011 Link to this post

    Hi Evgenia, this does indeed work in this example, but I probably wasn't clear in what I am trying to achieve. I want to be able plot a number of points on the chart and then programmatically set where the X and Y Axis grid lines appear and depending on where they appear that set the label to the mid-point of the grid lines, as in image5. Is this possible with the Telerik Chart control?

  7. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 14 Oct 2011 Link to this post

    Hi R,

    By default the GridLines of the Chart always appear where the XAxis Ticks are positioned. However in your case there is no way to make the space between the GridLines different.

    Best wishes,
    Evgenia
    the Telerik team
    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 their blog feed now
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017