2016-10-26 7 views
0

asp.net에서 다음 Kendo.Chart가 있고 차트 데이터를 새로 고칠 때 단계 값을 변경해야합니다.자바 스크립트에서 단계 값 변경

.Step

에 (8)

.Step (0)

내가 어떻게 할 수 있습니까?

@(Html.Kendo().Chart<GenericDateTimeValueDataPoint>() 
           .Name("trendchart_" + location.LocationId) 
           .Legend(legend => legend.Visible(false)) 
           .ChartArea(chartArea => chartArea.Background("transparent") 
            .Height(276)) 
           .AutoBind(false) 
           .DataSource(ds => ds.Read(read => read.Action("ProfileTrend", "Chart") 
            .Data(@<text>function(){ var selectedTimespan = $('#duration option:selected').val(); var startDateTime = $('#startDateTimePicker').val(); var endDateTime = $('#endDateTimePicker').val() ; return { locationGuid: '@location.LocationId', timespan: selectedTimespan, startDateTime: startDateTime, endDateTime: endDateTime, timeZoneOffset: window.currentTimeZoneOffsetInHours }}</text>)) 
            .Events(ev => ev.RequestStart("viewModel.utilisationDataRequestStarted") 
             .RequestEnd("uViewModel.utilisationDataLoaded"))) 
           .SeriesDefaults(series => series.Column().Overlay(ChartBarSeriesOverlay.None)) 
           .Series(series => series.Column(model => model.CollectedValue, categoryExpression: model => model.DateTimeFormattedString) 
            .Gap(0.3) 
            .Name("Valve Open") 
            .Color(Lookups.GetColourAsHex(Colours.SilverGrey))) 
           .CategoryAxis(axis => axis.MajorGridLines(lines => lines.Visible(false)) 
            .Labels(labels => labels.Format("{0:d}").Step(8)) 
            .Categories() 
            .Title(title => title.Text(DisplayText.Get("Time")))) 
           .ValueAxis(axis => axis.Numeric().Labels(labels => labels.Format("{0}%")).Line(line => line.Visible(true)).Min(0).Max(100).Title(title => title.Text(DisplayText.Get("Utilisation")))).Tooltip(tooltip => tooltip.Visible(true).Template("#=dataItem.DateTimeFormattedString#<br />#= kendo.format('{0:N2}',value) #%"))) 
+0

단계별로 어떤 의미입니까? 페이징을 의미합니까? –

+0

아니요,이 차트는 값을 표시 할 단계 점수의 수입니다. – Coppermill

답변

1

당신은 다음이 콜백에 당신이 step 속성을 설정/변경할 수 있습니다 (데이터를 차트에 바인딩 될 때마다 해고)를 dataBound 이벤트에 콜백을 추가 할 수 있습니다. 그러나 변경 사항을 적용하려면 refresh 메서드를 검도 차트에서 호출해야합니다.

코드는 다음과 같은 것이다 :

//Your code 
.Events(ev => ev.RequestStart("viewModel.utilisationDataRequestStarted") 
.RequestEnd("uViewModel.utilisationDataLoaded"))) 
.DataBound("onDataBound"))) 
//Your code 

//Javascript 
function onDataBound(arg) { 
    var chart = $("ELEMENT_ID").getKendoChart(); 
    chart.options.axisDefaults.labels.step = 2; 
    chart.refresh(); 
} 

은 당신을 도움이되기를 바랍니다.