This is a migrated thread and some comments may be shown as answers.

Bind chart data from IEnumberable property of local data

1 Answer 77 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joan
Top achievements
Rank 1
Joan asked on 08 Oct 2014, 02:17 PM
I am creating a bubble chart by using MVC and would like to bind this chart from local data as the example in the link http://demos.telerik.com/aspnet-mvc/bubble-charts/local-data-binding.

The model I use is slightly different from the example.  I have a view model object,BubbleChartModel,contains a IEnumberable<MVCSample.Data.PGDataBySupplier> property called "DataPoints".
When I tried to bind the bubbles to this IEnumberable<MVCSample.Data.PGDataBySupplier> property, I received the error of

The model item passed into the dictionary is of type 'System.Collections.Generic.List`1[MVCSample.Data.PGDataBySupplier]', but this dictionary requires a model item of type 'MVCSample.Models.BubbleChartModel'.

I am wondering if my approach is supported by Telerik. If not, is there any workaround?


Following is my code:

@model MVCSample.Models.BubbleChartModel
<div class="chart-wrapper">
@(Html.Kendo().Chart(Model.DataPoints)
.Name("chart")
.Series(series =>
{
series.Bubble(
model => model.PercentSavingsLow,
model => model.PotentialSavingsAvg,
model => model.TotalSpend,
model => model.ProviderShortName,
model => model.MemberStatECOLOR,
model => model.DisplayLegend,
model => model.ProviderShortName


); 
                     }
)
)


)

1 Answer, 1 is accepted

Sort by
0
Hristo Germanov
Telerik team
answered on 10 Oct 2014, 06:47 AM
Hi Joan,

This error is not related with Kendo UI Chart. The model for your view must be the same as the dictionary that you pass. If you pass IEnumberable<MVCSample.Data.PGDataBySupplier> the model must be @model IEnumberable<MVCSample.Data.PGDataBySupplier>

Regards,
Hristo Germanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Joan
Top achievements
Rank 1
Answers by
Hristo Germanov
Telerik team
Share this question
or