Skip to content

Instantly share code, notes, and snippets.

@corradio
Last active September 28, 2017 06:47
Show Gist options
  • Select an option

  • Save corradio/51d0d2ad3f71acf986490fa0dfee7462 to your computer and use it in GitHub Desktop.

Select an option

Save corradio/51d0d2ad3f71acf986490fa0dfee7462 to your computer and use it in GitHub Desktop.
app.title = '坐标轴刻度与标签对齐';
option = {
tooltip : {
trigger: 'axis',
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis : [
{
type : 'value'
}
],
yAxis : [
{
type : 'category',
data : ['Wind Onshore', 'Hydro Pumped Storage', 'Other renewable', 'Fossil Oil shale', 'Hydro Water Reservoir', 'Biomass', 'Fossil Coal-derived gas', 'Geothermal', 'Waste', 'Nuclear', 'Fossil Hard coal', 'Fossil Oil', 'Other', 'Marine', 'Hydro Run-of-river and poundage', 'Wind Offshore', 'Fossil Brown coal/Lignite', 'Solar', 'Fossil Gas', 'Fossil Peat'],
axisTick: {
alignWithLabel: true
}
}
],
series : [
{
name:'2016',
type:'bar',
data:[10, 52, 200, 334, 390, 330, 220, 10, 52, 200, 334, 390, 330, 220, 10, 52, 200, 334, 390, 330]
},
{
name:'2017',
type:'bar',
data:[390, 330, 10, 52, 200, 334, 390, 330, 220, 10, 52, 200, 334, 390, 330, 220, 10, 52, 200, 334]
}
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment