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

Chart localization and univarsal date time issues

3 Answers 297 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Sourabha
Top achievements
Rank 1
Sourabha asked on 06 Dec 2012, 06:09 AM
I am getting following issues for kendoui chart

Question 1)  Chart datetime UTC issue-
I am able to format the datetime to UTC by using the template but same functionality is not available in chart.
template: '#= moment(new Date(PeriodEnd)).format(\'YYYY-MM-DD HH:mm:ss\') #'

Following is my code for chart

<div data-bind="kendoChart: { data:  SeriesValues, series: [{ name: 'Quantity', field: 'Quantity' }],  tooltip: {visible: true},
                       legend: {position: 'top'}, 
                        title: { text: 'Quantity vs Time - Bar Graph'},                       ,
        categoryAxis: { field: 'PeriodEnd', labels:{rotation: -60} } 
                                              }"></div>
 
i am looking to convert the UTC format of my field: 'PeriodEnd'.

Question 2)
Chart text localization from .resx file
                for the above code I am looking for localizing the 'Quantity' and 'Quantity vs Time - Bar Graph' from .resx file.
              we databind the keys from .resx as follows (Please see following line) but I cant do same in chart.
               <span data-bind="restext: 'selectgraph'" class="viewLabels"></span>
              
          

3 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 10 Dec 2012, 11:12 AM
Hello,

A template option is available for the category axis:
labels: {
    template: '#= moment(new Date(value)).format(\'YYYY-MM-DD HH:mm:ss\') #'
}


You can use inline code to render the localized string, as described on MSDN:
LocRM= new ResourceManager("LocProject.strings", typeof(WebForm1).Assembly);

<%=LocRM.GetString("selectgraph")%>

I hope this helps.

Kind regards,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Sourabha
Top achievements
Rank 1
answered on 11 Dec 2012, 09:18 AM
TEMPLATE OPTION IS NOT WORKIGN FOR CHART CONTROL. IT IS WORKING FINE WITH GRID CONTROL

GRID CONTROL LOGIC
 <div>
  <div data-bind="kendoGrid: { data:  SeriesValues, columns: [{field: 'IsLocked', title: 'Is Locked', width: 150}, {field: 'IsValid', title: 'Is Valid', width: 150},
   {field: 'PeriodEnd', title: 'Period End', template: '#= moment(new Date(PeriodEnd)).format(\'YYYY-MM-DD HH:mm:ss\') #', width: 250},
   {field: 'Quantity', title: 'Quantity', width: 150},
   {field: 'QualityIndex',title: 'Quality Index'}], scrollable: true, sortable: true}" style="height: 200px"></div>
 </div>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
CHART CONTROL LOGIC - TEMPLATE OPTION IS NOT WORKIGN FOR CHART CONTROL.

<div data-bind="kendoChart: { data:  SeriesValues, series: [{ name: 'Quantity', field: 'Quantity' }],  tooltip: {visible: true},legend: {position: 'top'},
   
                        title: {
                            text: 'Quantity vs Time - Bar Graph'
                        }
                        ,
                        categoryAxis: {
                            field: 'PeriodEnd',
          labels:{rotation: -60,template: '#= moment(new Date(PeriodEnd)).format(\'YYYY-MM-DD HH:mm:ss\') #'}
                        } }"></div>
  </div>

 
0
T. Tsonev
Telerik team
answered on 12 Dec 2012, 10:21 PM
Hello,

Please note that the template variable in the Chart is value, as described in the docs. Category axis label templates have no direct access to DataItem fields.

This is the example template I used earlier:
labels: {
    template: '#= moment(new Date(value)).format(\'YYYY-MM-DD HH:mm:ss\') #'
}


All the best,

Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Chart
Asked by
Sourabha
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Sourabha
Top achievements
Rank 1
Share this question
or