chartjs-chart-error-bars
chartjs-chart-error-bars copied to clipboard
lineWithErrorBars
Hi Team, We are facing issue to create Line chart with error bars(lineWithErrorBars). We are getting issue with canvas context issue s undefined, Where same configuration working with barWithErrorBars. So if possible can you provide the reference code for lineWithErrorBars . We are using chart js 3.6.0 version and chartjs-chart-error-bars/v/3.6.0 version. above mentioned npm packges we are using with angular 12.
Thanks, M.dev
without code it is impossible to tell what is going on, since https://codepen.io/sgratzl/pen/rNGvqXb
works just fine
We are using angular 12 with chart js 3.6.2 version. For the error bars we r using version ^3.6.0. npm package, As suggested in link below: https://www.npmjs.com/package/chartjs-chart-error-bars
We are taking canvas reference using @viewChild decorator in Angular. We r able to render barWithErrorBrs controller bar chrt , But when we use lineWithErrorBars , its having error as undefined context.
So please suggest if we need to do any config changes.
Continue to @mahadev-Pandhare comment, we are getting below error in console. It is happening with only lineWithErrorBars

barWithErrorBrs is working fine.
const tempChart: any = {
type: 'barWithErrorBars',
data: {
labels: ['A', 'B'],
datasets: [
{
data: [
{
y: 4,
yMin: 1,
yMax: 6,
},
{
y: 2,
yMin: 1,
yMax: 4,
},
],
},
],
},
options: {
scales: {
y: {
ticks: {
beginAtZero: true,
},
},
},
},
plugins: [BarWithErrorBarsController]
}
this.canvas = this.resourceComboChartEl.nativeElement;
this.ctx = this.canvas.getContext('2d');
this.resourceComboChart = new Chart(this.ctx, tempChart);
this.resourceComboChart.update();

While doing analysis we found that DatasetController getting called twice for lineWithErrorBars, any idea why it is getting called twice? does any configuration is required to stop second call?

can you create a codesandbox or similar with a setup that is showing this error? Otherwise, I don't know how to investigate this error since it works fine in the codepen I sent before