Home > Software design >  Highcharts data module: filtering specific columns in referenced HTML table
Highcharts data module: filtering specific columns in referenced HTML table

Time:10-03

Full example:

https://jsfiddle.net/gbeatty/4byg0p2t/

    data: {
        table: 'datatable',
        startRow: 0,
        endRow: 6,
        startColumn: 0,
        endColumn: 3,
        parsed: function (columns) {
            columns.forEach(column => {
                column.splice(1, 2);
            });
        }
    },

What I'd like the chart to reference is only column 0 "Year" and column 3 "Group C" while keeping the entire table displayed below. Challenge is disregarding the 2 columns in the middle.

I am trying the parsed option but it seems the rows and columns are mixed up. I even tried setting the switchRowsAndColumns value to true. (https://api.highcharts.com/highcharts/data.seriesMapping)

CodePudding user response:

You can also use complete function to modify your data.

Example code based on your config:

complete: function(options) {
  let series = [];
  series.push(options.series[2]);
  options.series = series;
}

Demo:

https://jsfiddle.net/BlackLabel/tfs4ubcL/

API Reference:

https://api.highcharts.com/highcharts/data.complete

  • Related