PptxGenJS icon indicating copy to clipboard operation
PptxGenJS copied to clipboard

Error Bar in Data

Open LanPodder opened this issue 5 years ago • 2 comments

Trying to create a multi chart consisting of bars and a line. I want to add a custom error rate to the line from my data. i currently see no way to do this. currently im doing

var dataChart = [
  {
    type: pptx.charts.BAR,
    data: [{
      name: 'region1',
      labels: labels,
      values: [0.08, 0.16, 0.27, 0.19, 0.15, 0.16]
    },
    {
      name: 'region2',
      labels: labels,
      values: [0.2, 0.17, 0.19, 0.2, 0.13, 0.11]
    }],
    options: {
      chartColors: ['0a2657', '0080ff'],
      barGrouping: 'standard'
    }
  },
  {
    type: pptx.charts.LINE,
    data: [{
      name: 'line',
      labels: labels,
      values: line_data
    },
    {
      name: 'Error_Rate',
      labels: labels,
      values: error_data
    }],
    options: {
      chartColors: ['ffb22b'],
      lineDataSymbol: 'triangle',
      lineSize: 1,
      barGrouping: 'standard',
      secondaryValAxis: !!opts.valAxes,
      secondaryCatAxis: !!opts.catAxes
    }
  }
];

what i want it to look like is something like this: image

but currently its looking like this: image

LanPodder avatar Jan 16 '20 10:01 LanPodder

Looking at the source code, it seems this library does not support this feature yet. Although it seems very simple to implement at first sight.

LanPodder avatar Jan 23 '20 09:01 LanPodder

I have looked further into library code, to see if i could add the error bar feature, specifically into gen-charts.ts

The main "value insertion" happens within "makeChartType" and as far as i can tell it seems to be refering to the sheet using a idx variable. however, in order to add error bars to specific lines/bars inside the chart we would need to be able to refer to specific columns.

Not sure how to go about that

LanPodder avatar Feb 05 '20 15:02 LanPodder

can u plz add this feature , its really important one

jadzeino avatar Dec 01 '22 10:12 jadzeino