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

Date Axis not matching input

2 Answers 61 Views
Chart (HTML5)
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 15 Aug 2017, 07:01 PM

Very simple case, the X-axis has dates, but the day _before_ is being shown on the access.  Date input looks like:

2017/8/7

2017/814

But 0/6 and 8/13 are shown.  See attachment.  This happens in all cases regardless of number of records.

<telerik:RadHtmlChart ID="burndownChart" runat="server" DataSourceID="dsBurndown" Skin="Web20">
            <PlotArea>
                <XAxis DataLabelsField="WeekDate">
                </XAxis>
                <YAxis Name="$">
                </YAxis>
                <Series>
                    <telerik:AreaSeries AxisName="$" DataFieldY="Spent" Name="Spent" Stacked="True">
                        <LabelsAppearance Visible="true" DataField="WeekDate"></LabelsAppearance>
                    </telerik:AreaSeries>
                    <telerik:AreaSeries AxisName="$" DataFieldY="Remaining" Name="Remaining" Stacked="True">
                    </telerik:AreaSeries>
                </Series>
            </PlotArea>
        </telerik:RadHtmlChart>

2 Answers, 1 is accepted

Sort by
0
Alex
Top achievements
Rank 1
answered on 16 Aug 2017, 01:15 PM

Since my inputs are single days (Mondays), I could use a workaround like the following:

<XAxis DataLabelsField="WeekDate" Visible="True" Type="Date" BaseUnit="Days" BaseUnitStep="7" >

 

However, the question still stands, how would I use the Unit of Weeks, but start on/show Monday's for the markers?  Or arbitrary day for that matter.

0
Marin Bratanov
Telerik team
answered on 23 Aug 2017, 04:00 PM

Hi Alex,

Perhaps an option is to tweak the data source provided to the chart as follows:

  • Aggregate the data according to your preferences (the chart has a default SUM aggregate for the data points in the range). Thus, you will have a single data point for the desired time period.
  • Create a string representation of the date according to your preferences, and add that to a field in the data source for the corresponding aggregated data point.
  • Provide these two fields to the chart and use a "regular" categorical axis where the chart will display your text in axis labels the data in the series without attempting date operations itself.

 

Regards,

Marin Bratanov
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Chart (HTML5)
Asked by
Alex
Top achievements
Rank 1
Answers by
Alex
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or