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

[Solved] Kendo Chart with grouped data source and pan and zoom

3 Answers 132 Views
Chart-
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
SHARAT
Top achievements
Rank 1
SHARAT asked on 29 Oct 2014, 02:31 PM
hi,

I need a functionality similar to this http://demos.telerik.com/kendo-ui/bar-charts/pan-and-zoom but with groupeddatasource.
Also i have the zoom and pan as image buttons outside the chart, so i am planning to something like this

function redrawChart() {
    var mddchrt = $("#chart").data("kendoChart");
    var mds = mddchrt.dataSource;
    if (srtOptSel == "NA") {
        mds.sort([{ field: "GROUP_FLD", dir: "asc" }, { field: "NAME", dir: "asc"}]);
    } else if (srtOptSel == "ND") {
        mds.sort([{ field: "GROUP_FLD", dir: "asc" }, { field: "NAME", dir: "desc"}]);
    } else if (srtOptSel == "VA") {
        mds.sort([{ field: "GROUP_FLD", dir: "asc" }, { field: "VALUE", dir: "asc"}]);
    } else if (srtOptSel == "VD") {
        mds.sort([{ field: "GROUP_FLD", dir: "asc" }, { field: "VALUE", dir: "desc"}]);
    }

    mddchrt.refresh();
}  

sorting is working fine. but how do i set the pagesize and page variables for chart with grouped datasource.

If i try to edit this example , http://demos.telerik.com/kendo-ui/bar-charts/grouped-data , 

if i give 
dataSource:
{
data: stocksDataSource,
pageSize: 3,
page: 2
}

instead of 

dataSource: stocksDataSource

it is not working, how can i make it work

Thanks













3 Answers, 1 is accepted

Sort by
0
Accepted
T. Tsonev
Telerik team
answered on 31 Oct 2014, 01:10 PM
Hello,

The DataSource will normally page through each group before moving on to the next.
There's no correct page size that will pick up equal number of items for each group.

You can see this if you group by any column in this Grid demo.

I have an older version of this demo that uses filtering.
If we sync the the filtering field across the grouped series the pan & zoom will continue to work.

I've tried to add as many comments as I could, but please ask if anything is unclear.
I hope this helps.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
SHARAT
Top achievements
Rank 1
answered on 31 Oct 2014, 03:29 PM
I have achieved my objective by filtering the dataset as you have done. Just wanted to know if telerik has something already builtin to achieve it.

Thank you.
0
T. Tsonev
Telerik team
answered on 04 Nov 2014, 08:31 AM
Hi,

The data source grouping behavior is unlikely to change anytime soon.
Thus, your approach is the best that can be done at the moment.

What we can do is to address this with a proper virtual scrolling implementation.
This is still some time in the future though.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Chart-
Asked by
SHARAT
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
SHARAT
Top achievements
Rank 1
Share this question
or