Black Lives Matter. Please consider donating to Black Girls Code today.

Adding a bar trace in a line chart with addTraces() not working

Hello,

When I try to add a bar trace using addTraces() in a scatter plot it draws a line instead of a bar.

Plotly.addTraces('plot' + this.chart.id, {
  x: ['2018-12-13 13:03:38'],
  y: ['30'],
  type: 'bar',
  hoverinfo: 'text',
  marker: {
    color: 'red',
  },
  base: 10,
  width: 100
});

This is the output when I console log the data of the plot:

Selection_005

Any idea of what I am doing wrong?

Update:

I tried to draw a bar chart but it still drawing a scatter plot.

I am using angular 7.

It seems to work ok:

1 Like