Chart localization and univarsal date time issues

4 posts, 0 answers
  1. Sourabha
    Sourabha avatar
    4 posts
    Member since:
    Dec 2012

    Posted 06 Dec 2012 Link to this post

    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>
                  
              
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 10 Dec 2012 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Sourabha
    Sourabha avatar
    4 posts
    Member since:
    Dec 2012

    Posted 11 Dec 2012 Link to this post

    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>

     
  5. T. Tsonev
    Admin
    T. Tsonev avatar
    2772 posts

    Posted 12 Dec 2012 Link to this post

    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!
Back to Top
UI for ASP.NET MVC is VS 2017 Ready