javascript - Kendo Line chart - baseUnit fit - tooltip displaying the wrong value -


i have following issue using kendo line chart when baseunit set "fit". the problem here mismatch between chart render , data. please open example: http://jsbin.com/geyeqi/edit?output

selecting second point under june 2013, i'm expecting following value: 4650. however, tooltip showing wrong value (4850).

does know how fix it? i've open ticket in telerik: http://www.telerik.com/forums/kendo-line-chart---baseunit-fit---tooltip-displaying-the-wrong-value

here code:

window.minimumdate = new date(date.parse('03/01/2013')); window.maximumdate = new date(date.parse('03/01/2015'));  $(document).ready(function () {     var createlinechart = function (mindate, maxdate) {          $("#plan-line-chart").kendochart({             datasource: {                 data: getprices(mindate, maxdate)             },             databound: function () {                 if (this.datasource.view().length <= 12) {                     this.options.categoryaxis.baseunit = "months";                 }             },             legend: {                 position: "top"             },             seriesdefaults: {                 type: "line",                 style: "smooth"             },             seriescolors: ["rgba(178, 44, 27, 1)"],             series:             [                  {                      field: "currentprice",                      name: "contributions",                      categoryfield: "date"                  }             ],             valueaxis: {                 majorgridlines: {                     visible: true                 },                 line: {                     visible: false                 },                 labels: {                     template: "#= formatamount(value) #"                 },             },             categoryaxis: {                 field: "date",                 type: "date",                 baseunit: "fit",                 labels: {                     rotation: 45                 },                 majorgridlines: {                     visible: false                 }             },             tooltip: {                 visible: true,                 format: "{0}%",                 template: "#= formatamount(value) #"             }         });     };     var rangeslideronchange = function (element) {         var mindate = new date(element.value[0]);         var maxdate = new date(element.value[1]);         var linechart = $("#plan-line-chart").data("kendochart");         if (linechart != undefined) {             linechart.destroy();             createlinechart(mindate, maxdate);         }     };      var templatestring = "#= formattomonthyear(selectionstart) # - #= formattomonthyear(selectionend) #";      $("#plan-range-slider").kendorangeslider({         change: rangeslideronchange,         min: window.minimumdate.gettime(),         max: window.maximumdate.gettime(),         smallstep: 86400000,         largestep: 86400000,         tickplacement: "none",         tooltip: {             template: kendo.template(templatestring)         }     });      createlinechart(window.minimumdate, window.maximumdate); });  function formatamount(amount) {     return kendo.tostring(amount, "#,##0.00"); } function formattomonthyear(val) {     return kendo.tostring(new date(val), 'mmm yyyy'); }  function getprices(min, max) {     var prices = [        {            "date": new date(date.parse('03/01/2015')),            "currentprice": 8250.00        },        {            "date": new date(date.parse('02/01/2015')),            "currentprice": 8000.00        },        {            "date": new date(date.parse('01/01/2015')),            "currentprice": 7750.00        },        {            "date": new date(date.parse('12/01/2014')),            "currentprice": 7500.00        },        {            "date": new date(date.parse('11/01/2014')),            "currentprice": 7250.00        },        {            "date": new date(date.parse('10/01/2014')),            "currentprice": 7000.00        },        {            "date": new date(date.parse('09/01/2014')),            "currentprice": 6750.00        },        {            "date": new date(date.parse('08/01/2014')),            "currentprice": 6550.00        },        {            "date": new date(date.parse('07/01/2014')),            "currentprice": 6350.00        },        {            "date": new date(date.parse('06/01/2014')),            "currentprice": 6150.00        },        {            "date": new date(date.parse('05/01/2014')),            "currentprice": 5950.00        },        {            "date": new date(date.parse('04/01/2014')),            "currentprice": 5750.00        },        {            "date": new date(date.parse('03/01/2014')),            "currentprice": 5550.00        },        {            "date": new date(date.parse('02/01/2014')),            "currentprice": 5450.00        },        {            "date": new date(date.parse('01/01/2014')),            "currentprice": 5350.00        },        {            "date": new date(date.parse('12/01/2013')),            "currentprice": 5250.00        },        {            "date": new date(date.parse('11/01/2013')),            "currentprice": 5150.00        },        {            "date": new date(date.parse('10/01/2013')),            "currentprice": 4950.00        },        {            "date": new date(date.parse('09/01/2013')),            "currentprice": 4950.00        },        {            "date": new date(date.parse('08/01/2013')),            "currentprice": 4850.00        },        {            "date": new date(date.parse('07/01/2013')),            "currentprice": 4750.00        },        {            "date": new date(date.parse('06/01/2013')),            "currentprice": 4650.00        },        {            "date": new date(date.parse('05/01/2013')),            "currentprice": 4550.00        },        {            "date": new date(date.parse('04/01/2013')),            "currentprice": 4450.00        },        {            "date": new date(date.parse('03/01/2013')),            "currentprice": 4350.00        }     ];      var currentprices = [];     $("#currentprices").text('');     var mindate = new date((min.getmonth() + 1) + '/01/' + min.getfullyear());     var maxdate = new date((max.getmonth() + 1) + '/01/' + max.getfullyear());     (var = prices.length - 1; >=  0; i--) {         if (prices[i].date >= mindate && prices[i].date <= maxdate) {             currentprices.push(prices[i]);              $("#currentprices").append("<li>" + kendo.tostring(prices[i].date, 'mmm yyyy') + " :: " + prices[i].currentprice + "</li>");         }     }     return currentprices; } 

thanks telerik able find way fix it. please read reply.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -