I need to do a set of simple bar graphs that show expenditures by the year. It’s working except that the Years in the x-axis are treated as numeric values and Plotly inserts increments. So instead or 2021 and 2022, I get 2021, 2,021.5 and 2022.
How do I get Plotly to recognize them as text values and leave out the increments?
var data = [ { type: ‘bar’,
x: [2020,2021,2022],
y: [949016,2734043,1696656],
marker: { color: ‘#932BD4’}, }];
var layout = {
yaxis: { title: ‘Expenditure (Dollars)’ },
xaxis: { title: ‘Year’ } };
Plotly.newPlot(‘myDiv’, data, layout);