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

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


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' +, {
  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:


Any idea of what I am doing wrong?


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