I am trying to draw a horizontal boxplot in Excel using Script Lab. For this, I first created a stacked bar chart and made the first and the last bars as transparent. Now I am trying to add error bars to the data bar in the middle using the following snippet:
async function addErrorBars() {
await Excel.run(async (context) => {
const sheet = context.workbook.worksheets.getItem("Sample");
var chart = sheet.charts.getItemAt(0);
chart.series.getItemAt(3).xErrorBars.visible = true;
chart.series.getItemAt(3).xErrorBars.type = Excel.ChartErrorBarsType.percent;
chart.series.getItemAt(3).xErrorBars.include = Excel.ChartErrorBarsInclude.both;
chart.series.getItemAt(3).xErrorBars.endStyleCap = true;
await context.sync();
});
}
However, I do not see any xerror bars in my stacked bar chart. Can someone please guide me as I do not know what am I doing wrong?
And if I choose chart.series.getItemAt(3).xErrorBars.type = Excel.ChartErrorBarsType.custom;
, then how can I specify the custom value?
PS: If there is a better way to draw a horizontal box plot in Excel using Script lab, then please let me know.
Thanks
Vinni