Add drill-down to your chart by linking it to a SharePoint l

by Vegard Grutle » Mon Jul 25, 2016 11:19 am

Hi,

I have tried to follow the example on how to add drill-down to a chart by linking it to a SharePoint list http://www.spchart.com/documentation/link-chart-to-list

Could you please advise if there are errors in the code? I want to filter on "Issue Status". The code has been copied in Dashboard → Advanced tab. Please see code below:

Code: Select all
var handlers = {};
handlers.preRender = function (config, logger) {
    logger.debug('Configuration: ', config);
 
    var filtrationApplied = false;
 
    config.plotAreaClick = function (e) {
        if (!filtrationApplied) {
            window.location.hash = '';
        }
 
        filtrationApplied = false;
    }
 
    config.seriesClick = function (e) {
        if (ctx && ctx.clvp) {
            var filter =
              'FilterField1=IssueStatus-FilterValue1=' + e.dataItem.IssueStatus + '-'+
               
            window.location.hash = 'InplviewHash' +
            ctx.clvp.wpid + '=' + encodeURIComponent(filter);
 
            filtrationApplied = true;
        }
    }
 
    return true;
}


Thanks, in anticipation,

Vegard
Vegard Grutle
 
Posts: 2
Joined: Mon Jul 25, 2016 11:04 am

by Dmitry Kozlov » Mon Jul 25, 2016 3:43 pm

Hi Vegard,
The code looks fine. Probably, you have multiple views on the page and the 'ctx.clvp.wpid' returns incorrect view Id. Try to compare URLs you get after clicking the chart series and filtering the view direclty by clicking its column headers.
User avatar
Dmitry Kozlov
 
Posts: 129
Joined: Wed Nov 12, 2014 3:24 pm

by Vegard Grutle » Mon Jul 25, 2016 7:41 pm

Hi, Dmitry

I have removed all the views on the list. The URL is unaffected when clicking on the series.

Brg,

Vegard
Vegard Grutle
 
Posts: 2
Joined: Mon Jul 25, 2016 11:04 am

by Dmitry Kozlov » Tue Jul 26, 2016 12:46 pm

The following condition returns 'false' when the page does not contain a list view:
if (ctx && ctx.clvp)

The page must contain at least one view to link the chart to it. Our support team can assist you with the task. Send the detailed requirements to support@spchart.com and we will estimate them.
User avatar
Dmitry Kozlov
 
Posts: 129
Joined: Wed Nov 12, 2014 3:24 pm


Return to Dashboard Designer for SharePoint 2013