• echarts 柱状图及折线图常用设置


    echarts 柱状图及折线图基础效果功能设置

    记录一下 下次直接使用

    1. option = {
    2. legend: {},
    3. grid: {
    4. left: '3%',
    5. right: '4%',
    6. bottom: '3%',
    7. containLabel: true
    8. },
    9. tooltip: {
    10. trigger: 'axis',
    11. axisPointer: {
    12. type: 'shadow'
    13. }
    14. // formatter: '{b}
      {a0}:{c0}
      {a1}:{c1}%'
    15. },
    16. // color: ['#A6FFC2', '#A6FFC2'],
    17. xAxis: [
    18. {
    19. type: 'category',
    20. data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    21. boundaryGap: true, // 两边是否留空白
    22. axisTick: {
    23. alignWithLabel: true // 文字居中
    24. },
    25. axisLabel: {
    26. show: true, //文字显示
    27. interval: 0 //使x轴文字显示全
    28. },
    29. splitLine: {
    30. show: false, // 显示轴线
    31. lineStyle: {
    32. type: 'dashed' // 轴线样式
    33. }
    34. }
    35. }
    36. ],
    37. yAxis: [
    38. {
    39. type: 'value',
    40. axisTick: {
    41. alignWithLabel: true // 文字居中
    42. },
    43. splitLine: {
    44. show: true, // 显示轴线
    45. lineStyle: {
    46. type: 'dashed' // 轴线样式
    47. }
    48. }
    49. }
    50. ],
    51. series: [
    52. {
    53. name: 'Direct',
    54. type: 'bar',
    55. data: [
    56. 10,
    57. 52,
    58. {
    59. value: 200,
    60. itemStyle: {
    61. color: '#a90000'
    62. }
    63. },
    64. 334,
    65. 390,
    66. 330,
    67. 220
    68. ],
    69. // color: '#A6FFC2', // 线条颜色
    70. showBackground: true, //显示背景颜色
    71. backgroundStyle: {
    72. color: 'rgba(180, 180, 180, 0.01)'
    73. },
    74. barWidth: '60%', //宽度
    75. barMaxWidth: '30', // 最大宽度
    76. label: {
    77. show: true, //显示数值
    78. position: 'top', //位置
    79. fontSize: 12
    80. },
    81. yAxisIndex: 0
    82. },
    83. {
    84. name: 'Directs',
    85. type: 'line',
    86. data: [820, 932, 901, 934, 1290, 1330, 1320],
    87. color: '#A6FFC2', // 线条颜色
    88. smooth: true,
    89. symbolSize: 8, //小圆点的大小
    90. symbol: function (value, ind) {
    91. if (5 == ind.dataIndex) {
    92. return 'circle';
    93. } else {
    94. return 'none';
    95. }
    96. },
    97. areaStyle: {
    98. color: {
    99. x: 0,
    100. y: 1,
    101. x2: 0,
    102. y2: 0,
    103. colorStops: [
    104. {
    105. offset: 0,
    106. color: 'rgba(166, 255, 194, 0)' // 0% 处的颜色
    107. },
    108. {
    109. offset: 1,
    110. color: '#A6FFC2' // 100% 处的颜色
    111. }
    112. ],
    113. global: false // 是否添加渐变
    114. }
    115. },
    116. // 显示最大值
    117. markPoint: {
    118. data: [{ type: 'max', name: 'Max' }]
    119. }
    120. }
    121. ]
    122. };
  • 相关阅读:
    elasticsearch 聚合之 date_histogram 聚合
    数据结构-并查集
    CSS中常用的选择器
    Electronica上海 Samtec 验证演示 | FireFly™Micro Flyover System™
    SQL注入之宽字节注入
    【C++】set & map的使用
    从ArcGIS两个DEM数据镶嵌结果错误说起——聊一聊像素类型和像素深度
    C++ 虚函数表
    Docker 安装 MySQL5.7 和 MySQL8
    『SpringBoot 源码分析』run() 方法执行流程:(3)刷新应用上下文-处理 @ComponentScan 注解
  • 原文地址:https://blog.csdn.net/qinlulucsdn/article/details/128012519