gitbrent / PptxGenJS

Create PowerPoint presentations with a powerful, concise JavaScript API.
https://gitbrent.github.io/PptxGenJS/
MIT License
2.9k stars 633 forks source link

Error Bar in Data #652

Open LanPodder opened 4 years ago

LanPodder commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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

jadzeino commented 1 year ago

can u plz add this feature , its really important one