asp.net mvc 4 - how to get data from JSON without using script? -


i want data json file without using script code!

iam using mvc4 , want put code in .cshtml file, how can this?

( iam using kendo function)

example:

@{     viewbag.title = "home page"; }  <div class="chart-wrapper">     @(html.kendo().chart()         .name("chart")                 .title(title => title                     .text("share of internet population growth, 2007 - 2012")                     .position(charttitleposition.bottom))         .legend(legend => legend             .visible(false)         )         .datasource(datasource=>datasource.read(read=>read.url("~/")))                .events(e => e.seriesclick("onserieshover"))         .series(series => {             series.pie(new dynamic[] {                 new {category="asia",value=53.8,color="#9de219"},                 new {category="europe",value=16.1,color="#90cc38"},                 new {category="latinamerica",value=11.3,color="#068c35"},                 new {category="africa",value=9.6,color="#006634"},                 new {category="middleeast",value=5.2,color="#004d38"},                 new {category="northamerica",value=3.6,color="#033939"}                        })             .labels(labels => labels                 .template("#= category #: #= value#%")                 .background("transparent")                 .visible(true)                 .color("red")             )             .startangle(150);         })         .tooltip(tooltip => tooltip             .visible(true)             .format("{0}%")         )      )      <script>         function onseriesclick(e) {             alert(kendo.format("series click :: {0} ({1}): {2}",                 e.series.name, e.category, e.value));         }       </script> </div> 

i have use .datasource(datasource=>datasource.read(read=>read.url("~/"))) not working

try this,

example

view

  @(html.kendo().chart<model.dashboardpiechartmodel>()             .name("piechartpopup")                     .events(events => events.databound("ondatabound"))           .legend(legend => legend             .visible(false)         )             .datasource(ds =>             {                 ds.read(read => read.action("read_piechart", "dashboard"));             }             )              .series(series =>             {                 series.pie(                     model => model.percentage,                     model => model.service, null, null                 ).labels(labels => labels             .visible(true)             .template("${ category } - ${ value }%")              ).overlay(chartpieseriesoverlay.none);             })              .tooltip(tooltip => tooltip             .visible(true)             .template("${ category } - ${ value }%")             )          ) 

controller

public jsonresult read_piechart()         {             //whatever here               return json(return data);         } 

read link: http://demos.kendoui.com/dataviz/pie-charts/remote-data.html


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -