Echarts柱状图百分比显示

冷不防 2022-09-12 12:58 380阅读 0赞
  1. option = {
  2. tooltip: {
  3. trigger: 'item',
  4. formatter:'{c}%'    //这是关键,在需要的地方加上就行了
  5. },
  6. grid: {
  7. borderWidth: 0,
  8. y: 80,
  9. y2: 60
  10. },
  11. xAxis: [
  12. {
  13. type: 'category',
  14. show: false,
  15. data: ['Line', 'Bar', 'Scatter', 'K', 'Pie', 'Radar', 'Chord', 'Force', 'Map', 'Gauge', 'Funnel']
  16. }
  17. ],
  18. yAxis: [
  19. {
  20. type: 'value',
  21. show: false
  22. }
  23. ],
  24. series: [
  25. {
  26. name: 'ECharts例子个数统计',
  27. type: 'bar',
  28. itemStyle: {
  29. normal: {
  30. color: function(params) {
  31. // build a color map as your need.
  32. var colorList = [
  33. '#C1232B','#B5C334','#FCCE10','#E87C25','#27727B',
  34. '#FE8463','#9BCA63','#FAD860','#F3A43B','#60C0DD',
  35. '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0'
  36. ];
  37. return colorList[params.dataIndex]
  38. },
  39. label: {
  40. show: true,
  41. position: 'top',
  42. formatter: '{b}\n{c}%'    //这是关键,在需要的地方加上就行了
  43. }
  44. }
  45. },
  46. data: [12,21,10,4,12,5,6,5,25,23,7],
  47. }
  48. ]
  49. };

watermark_type_ZHJvaWRzYW5zZmFsbGJhY2s_shadow_50_text_Q1NETiBAaHVheWFuZzE4Mw_size_20_color_FFFFFF_t_70_g_se_x_16

发表评论

表情:
评论列表 (有 0 条评论,380人围观)

还没有评论,来说两句吧...

相关阅读