Query |
Response | |
How can I use chart (linechar) and pivotchart with data from the database and entity framework data model. |
Chart Response:
We have prepared a sample with respect to your requirement. Here we have fetched data in the controller side and passed the data to view page using ViewBag and then bind the data to series.dataSource property as depicted below. Find the code snippet below to achieve this requirement.
Screenshot:
Chart line sample for reference can be find from below link.
Pivot Chart:
We have prepared sample based on your requirement. Please find the sample in below link.
| |
I have attached a sample below, take a look at, and what I want to do is create line chart where the axis is the columns database table fields and use grouping and filtering with some others fields. |
Yes. You can filter PivotChart using “filters” property. Please refer below code snippet.
Code Snippet: [cshtml]
In the sample, we have added “State” field in row axis and “Country” field in filter axis. Then, we filter “Canada” from “Country” field using the property “FilterItems”. For more details about “FilterItems”, kindly refer below documentation.
So, PivotChart displays the states belongs to “Canada” alone. Please refer below screenshot.
Meanwhile, we have modified your sample as per your requirement. Please find the sample in below link.
|