Pre-Evaluation: Are fixed axis dates possible?

3 posts, 1 answers
  1. Simon Wolters
    Simon Wolters avatar
    20 posts
    Member since:
    Mar 2010

    Posted 21 Jul 2011 Link to this post

    Hi,

    We are currently evaluating several third party charting components for a new project. One feature that always troubles us is the following:

    Imagine that the following datapoints of type <DateTime, double> are bound to a chart: 
    <6/30/11, 1.0>, <6/30/12, 2.0>, <6/30/13, 3.0>

    For our project it is very important that exactly the given dates (June 30 of each year) are shown on the x axis even if the exact distance in days between any two of them might not be equal. In this example I can't use a static interval (or "Step" as you call it) because adding one year to 6/30/11 doesn't necessarily result in 6/30/12 - it could also result in 7/1/12 or 6/29/12.

    We found out that almost every chart component applies some kind of axis interpolation to equalize the distance between any two tickmarks. I did a quick test with static data with the RadControls for Silverlight and noticed the same behaviour:
    <telerik:ChartArea LegendName="CustomLegend">
        <telerik:ChartArea.DataSeries>
            <telerik:DataSeries LegendLabel="Store Sales">
                <telerik:DataSeries.Definition>
                    <telerik:BarSeriesDefinition />
                </telerik:DataSeries.Definition>
                <telerik:DataPoint XValue="40724" YValue="1.604" />
                <telerik:DataPoint XValue="41090" YValue="3.859" />
                <telerik:DataPoint XValue="41455" YValue="6.299" />
                <telerik:DataPoint XValue="41820" YValue="8.757" />
                <telerik:DataPoint XValue="42185" YValue="9.939" />
                <telerik:DataPoint XValue="42551" YValue="10.788" />
                <telerik:DataPoint XValue="42916" YValue="11.022" />
                <telerik:DataPoint XValue="43281" YValue="11.376" />
                <telerik:DataPoint XValue="43646" YValue="11.615" />
                <telerik:DataPoint XValue="44012" YValue="11.892" />
                <telerik:DataPoint XValue="44377" YValue="12.181" />
            </telerik:DataSeries>
        </telerik:ChartArea.DataSeries>
        <telerik:ChartArea.AxisX>                               
            <telerik:AxisX IsDateTime="True" DefaultLabelFormat="dd.MM.yy"  />                               
        </telerik:ChartArea.AxisX>
    </telerik:ChartArea>

    results in the following x axis:
    interpolated x axis with RadChart
    Note that the second date I specified in my DataSource is "41090" which in fact is 6/30/12 and NOT 6/29/12.

    In most charting components you could use a CategoryAxis to use custom axis labels. This usually comes with the problem that the labels on such CategoryAxis are aligned between two Tickmarks while we need them to show under each tickmark.
    Because I couldn't dive in too deep into your component, my question is: Are the RadControls somehow able to show only exactly the dates on the x axis that we put into the datasource UNDER the appropriate tickmark (see what I need)? That would definitely be a killer feature for the RadControls.

    Another question aside from that is if it is possible to hide the first and last x axis label independant from the datasource.

    Thank you very much in advance!
  2. Answer
    Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 26 Jul 2011 Link to this post

    Hi Simon Wolters,RadChart support different layout modes for the X-axis. You can choose between:
    • Normal - in this mode, the ticks match labels. Best for Line charts and Area charts.
    • Inside - ticks match labels; a small margin on both sides is provided for better presentation. Use this for Bubble Charts, Stick and Candlestick charts.
    • Between - ticks are margins (labels are between two ticks); a small margin on both sides is provided. Useful for Bar charts.
    • Auto - depending on the chart type, RadChart will automatically select the best LayoutMode. For multi-series charts, layout mode is prioritized in this order: Between, Inside, Normal.

    I have created a small app for you using the sample data you provided. Please evaluate it and let us know what you think about it.

    Kind regards,
    Yavor Ivanov
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. Simon Wolters
    Simon Wolters avatar
    20 posts
    Member since:
    Mar 2010

    Posted 26 Jul 2011 Link to this post

    Thank you, this is very good news! We are now taking a deeper look into the RadControls for Silverlight.
Back to Top