Reputation: 133
I have an Echarts bar chart as show below. I want to fit the chart into the rectangle by moving it to the left. I can move the y-axis by using offset, but I want to move the entire chart to the left. Any suggestions?
option = {
width: 350,
height: 200,
title: {
show: true,
text: 'Chart Title'
},
xAxis: {
data: ['Oct 21', 'Nov 21', 'Dec 21', 'Jan 22', 'Feb 22', 'Mar 22']
},
yAxis: {
type: 'value',
min: 70,
max: 73,
interval: 1,
axisLabel: {
formatter: '{value}'
}
},
series: [
{
data: [71.98, 72.62, 72.26, 72.49, 71.91, 70.55],
type: 'bar',
itemStyle: {
color: '#fce7a3'
}
}
],
graphic: {
type: 'rect',
shape: {
left: 0,
top: 0,
width: 400,
height: 300
},
style:{
fill:'transparent',
stroke:"#999"
}
}
};
Upvotes: 0
Views: 1883
Reputation: 226
Use grid option. The left value can be either an integer or a percentage value or a string.
grid:{
left:40
}
Refer this.
Upvotes: 2