簡體   English   中英

echarts 條線到頂部

[英]echarts bar lines to top

如果圖表數據具有少量值,則它們位於中心位置。 可以置頂嗎?

  xAxis: {
    type: 'value',
  },
  yAxis: {
    type: 'category',
    data: ['Brazil', 'Indonesia']
  },
  series: [
    {
      type: 'bar',
      data: [18203, 23489]
    }
  ]

圖表截圖

你的名字讓我印象深刻,我兒子的名字是馬克西姆。 同樣,無論哪種方式,如果我正確理解您的要求。 如果我理解正確的話,你希望能夠將條形圖推到頂部並在你的情節底部留下空白空間。 那么完成此任務的最簡單方法是添加虛擬數據——空白內容以強制條形圖進入您要查找的方向。

您還可以指定barGapbarWidth和一些其他參數來控制條形的大小。

 var chart = echarts.init(document.getElementById("main")); var option = { xAxis: { type: 'value', }, yAxis: { type: 'category', data: ['', '', 'Brazil', 'Indonesia'] }, series: [{ type: 'bar', name: 'Pop', data: [ '', '', 18203, 23489,], }] } // All the above is applied to the chart chart.setOption(option, true);
 #main { margin-left: 50px; /* make space for the labels */ }
 <head> <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.1/dist/echarts.min.js"></script> </head> <body> <.--div container for the chart: this in the <body></body>--> <div id="main" style="width; 600px: height; 450px;"></div> </body>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM