pivottable icon indicating copy to clipboard operation
pivottable copied to clipboard

Get Full Data-Record by Datum & Trace-Key

Open Gykonik opened this issue 3 years ago • 1 comments

Is there a possibility to get (all) full data records gievn a datum and trace key? I want to create custom hover-templates for plotly-charts, which contain all available information about the data entry (and not only those ones dragged in the horizontal & vertical pivot-list). For this, my idea was to somehow modify this code inside of poltly_renderers.js:

for (j = 0, len = datumKeys.length; j < len; j++) {
    datumKey = datumKeys[j];
    val = parseFloat(pivotData.getAggregator(transpose ? datumKey : traceKey, transpose ? traceKey : datumKey).value());
    
    // Get the complete entry object(s) which belong to 'val, datumKey & traceKey' in here somehow...?
    // Then, a hover template with all keys & values of the object could be generated
    
    values.push(isFinite(val) ? val : null);
    labels.push(datumKey.join('-') || ' ');
}

I thought about using forEachMatchingRecord but I was unable to find the correct filters to only get the objects which contribute to the exact cell-value (note that the solution of using click-callback recommended in other issues doesn't work here, because I need to extract the relevant data inside of plotly_renderers.js)

Gykonik avatar Jul 15 '21 08:07 Gykonik

@nicolaskruchten Are there any news yet / was my question understandable? (If you just had no time until now, no problem - I'm just curious :) )

Gykonik avatar Jul 26 '21 12:07 Gykonik