BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
· Create separate model for grid or you can use JSON,SQL data as well. Here we have created simple CountriesSalesData model. Which contains TransactionID, CategoryName, ShipDate, SalesAmount
· Create grid and setting ActionComplete event as follows.
· Create simple chart as below
· When selecting a filter then ActionComplete event sent the request type as “filtering”. This request type indicates the selected filters data from the grid.
· You can get the data by using “ sender.model.currentViewData;”. Then use this data to chart as follows.
Screenshots:
· Before selecting the filter chart render by using default model.
· After filtering data by using category Books,Electronics the result as below
Chart:
Please find the below sample link to download the sample.
Sample Link:
WebApplication1
Please let us know if you have any concern.
Thanks,
Vinothkumar Arumugam.
Thank you Vinothkumar,
That looks just great! It'll take a short while until I can test it.
Thank you for your support, I really appreciate it.
Mika
Let's assume there is hundred records in dataset and I apply filters for grid to get fifty records visible on grid. Now if I do paging chart shows different view on each page. Thats due to sender.model.currentViewData; it refers to Grid property, right? I couldn't find a reference that would reveal other properties of Grid.
Or am I totally on wrong track?
WBR,
Mika
completeAction = function (sender) { var data = sender.model.currentViewData; // sender.model contains all Grid properties } |
var obj = $("#FlatGrid").ejGrid("instance."); var data = obj.model.currentViewData; |
Hi Alan,
Sorry for the inconvenience. We do not understand if whether you can place this total value on each point or use this for point yValues. Please revert back us in which scenario you will try to do with the sample for each chart point. It will be helpful for us to serve you.
Please let us know if you have any concern.
Thanks,
Vinothkumar Arumugam.
//Summarize Data by using each field. var books = movies = electronics = home = health = toys = clothing = sports = automotive = 0; for (var i = 0; i < data.length; i++) { switch (data[i].CategoryName) { case "Books": books += data[i].SalesAmount; data[i].Total = books; break; case "Movies": movies += data[i].SalesAmount; data[i].Total = movies; break; case "Electronics": electronics += data[i].SalesAmount; data[i].Total = electronics; break; case "Home": home += data[i].SalesAmount; data[i].Total = home; break; case "Health": health += data[i].SalesAmount; data[i].Total = health; break; case "Toys": toys += data[i].SalesAmount; data[i].Total = toys; case "Clothing": clothing += data[i].SalesAmount; data[i].Total = clothing; break; case "Sports": sports += data[i].SalesAmount; data[i].Total = sports; break; case "Automotive": automotive += data[i].SalesAmount; data[i].Total = automotive; break; } |
· First chart using data from grid based on each field summation as below.
· After you can filter the data which you want. Here we have filter data from grid using two fields Books, Clothing.
Find the below link to download the sample.
Sample Link:
http://www.syncfusion.com/downloads/support/forum/119539/ze/GridChart-680566688
Please let us know if you have any further query on this.
Thanks,
Vinothkumar Arumugam.