histroyline.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. (function () {
  2. 'use strict';
  3. var myChart = echarts.init(document.getElementById('data-content-line'));
  4. var option = {
  5. xAxis: {
  6. type: 'category',
  7. data: ['2010.03.01', '2010.03.01', '2010.03.01', '2010.03.01', '2010.03.01', '2010.03.01', '2010.03.01','2010.03.01','2010.03.01','2010.03.01','2010.03.01','2010.03.01'],
  8. axisLabel: {
  9. // X 轴标签
  10. rotate: 40,
  11. fontSize: 10
  12. },
  13. // 坐标轴线相关设置设置
  14. axisLine: {
  15. lineStyle: {
  16. color: '#fff'
  17. }
  18. },
  19. axisTick:{
  20. inside:true
  21. }
  22. },
  23. yAxis: {
  24. type: 'value',
  25. axisLine: {
  26. lineStyle: {
  27. color: '#fff'
  28. }
  29. },
  30. name:'℃',
  31. nameTextStyle:{
  32. color:'#52d2ff',
  33. fontSize:20
  34. },
  35. scale:true,
  36. axisTick:{
  37. inside:true
  38. }
  39. },
  40. series: [{
  41. data: [27.5, 30, 32.5, 26, 25, 30,26.5, 30.5, 26.8, 35, 29.7, 30],
  42. type: 'line',
  43. smooth: true,
  44. lineStyle:{
  45. color:'#4ab188',
  46. },
  47. areaStyle:{
  48. color:{
  49. x: 0,
  50. y: 0,
  51. x2:0,
  52. y2: 1,
  53. colorStops: [{
  54. offset: 0, color: '#4ab188' // 0% 处的颜色
  55. }, {
  56. offset: 0.5, color: '#085099' // 100% 处的颜色
  57. }, {
  58. offset: 1, color: 'rgba(8,80,153,0.05)' // 100% 处的颜色
  59. }],
  60. global: false // 缺省为 false},
  61. }
  62. },
  63. itemStyle:{
  64. color:'#4ab188'
  65. }
  66. }]
  67. };
  68. myChart.setOption(option);
  69. window.addEventListener('resize', function () {
  70. myChart.resize();
  71. })
  72. })()