Home Kendo Pie Chart won't render (remote data)
Reply: 1

Kendo Pie Chart won't render (remote data)

SAS20 Published in 2017-09-12 19:55:58Z

This is just one example of the many iterations I tried. Essentially, I want to show a pie chart with job types by cost amount. I am able to connect to the database fine, I was able to successfully make a Kendo grid. Any and all help is appreciated!


            .Title("Job Types to Cost")
            .DataSource(dataSource => dataSource
                .Read(read => read.Action("Jobs_Read", "Reports").Type(HttpVerbs.Get))
            .Legend(legend => legend
            .Series(series =>
                    x => x.JOB_TYPE,
                    x => x.JOB_COST


    public ActionResult Jobs_Read([DataSourceRequest]DataSourceRequest request)
        return Json(GetJobs().ToDataSourceResult(request), JsonRequestBehavior.AllowGet);

    private IQueryable<JobViewModel> GetJobs()
        return from job in dbEntities.Jobs
               select new JobViewModel
                   ID = job.ID,
                   DATE = job.DATE,
                   JOB_TYPE = job.JOB_TYPE,
                   JOB_COST = job.JOB_COST
kryptonkal Reply to 2017-09-12 20:02:40Z

Flip your values around for the pie chart series data:

        .Series(series =>
                x => x.JOB_COST,
                x => x.JOB_TYPE                    

The method signature is this:

ChartPieSeriesBuilder<TModel> Pie<TValue>(Expression<Func<TModel, TValue>> expressionValue, Expression<Func<TModel, string>> categoryExpression <Func<TModel, string>> expressionColor = null, Expression<Func<TModel, bool>> expressionExplode = null, Expression<Func<TModel, bool>> expressionVisibleInLegend = null);

IIRC, kendo only accepts numeric values for the expressionValue parameter.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.411094 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO