1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
| {% raw %} <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts@4.7.0/dist/echarts.min.js"></script> <style> #categories-chart, #posts-chart, #tags-chart { width: 100%; height: 300px; margin: 0.5rem auto; padding: 0.5rem; overflow-x: auto; } </style>
<div id="posts-chart"></div> <script id="postsChart"> let postsChart = echarts.init(document.getElementById('posts-chart')); let postsOption = { title: { text: '文章发布统计图', top: -5, x: 'center' }, tooltip: { trigger: 'axis' }, xAxis: { type: 'category', data: ["2019-12","2020-01","2020-02","2020-03","2020-04","2020-05","2020-06","2020-07","2020-08","2020-09","2020-10","2020-11","2020-12"] }, yAxis: { type: 'value', }, series: [ { name: '文章篇数', type: 'line', color: ['#6772e5'], data: [0,0,0,0,0,0,0,0,0,0,11,7,27], markPoint: { symbolSize: 45, color: ['#fa755a','#3ecf8e','#82d3f4'], data: [{ type: 'max', itemStyle: {color: ['#3ecf8e']}, name: '最大值' }, { type: 'min', itemStyle: {color: ['#fa755a']}, name: '最小值' }] }, markLine: { itemStyle: {color: ['#ab47bc']}, data: [ {type: 'average', name: '平均值'} ] } } ] }; postsChart.setOption(postsOption); </script>
<!-- "data-length"为显示标签个数(从多到少),默认为10 -->
<div id="tags-chart" data-length="10"></div> <script id="tagsChart"> let tagsChart = echarts.init(document.getElementById('tags-chart')); let tagsOption = { title: { text: 'Top10标签统计图', top: -5, x: 'center' }, tooltip: {}, xAxis: [ { type: 'category', data: ["default","百度收录","LaTex","jsdelivr","GitHub Action"] } ], yAxis: [ { type: 'value' } ], series: [ { type: 'bar', color: ['#82d3f4'], barWidth : 18, data: [45,2,1,1,1], markPoint: { symbolSize: 45, data: [{ type: 'max', itemStyle: {color: ['#3ecf8e']}, name: '最大值' }, { type: 'min', itemStyle: {color: ['#fa755a']}, name: '最小值' }], }, markLine: { itemStyle: {color: ['#ab47bc']}, data: [ {type: 'average', name: '平均值'} ] } } ] }; tagsChart.setOption(tagsOption); </script>
<div id="categories-chart"></div> <script id="categoriesChart"> let categoriesChart = echarts.init(document.getElementById('categories-chart')); let categoriesOption = { title: { text: '文章分类统计图', top: -4, x: 'center' }, tooltip: { trigger: 'item', formatter: "{a} <br/>{b} : {c} ({d}%)" }, series: [ { name: '分类', type: 'pie', radius: '50%', color: ['#6772e5', '#ff9e0f', '#fa755a', '#3ecf8e', '#82d3f4', '#ab47bc', '#525f7f', '#f51c47', '#26A69A'], data: [{"name":"default","value":45}], itemStyle: { emphasis: { shadowBlur: 10, shadowOffsetX: 0, shadowColor: 'rgba(0, 0, 0, 0.5)' } } } ] }; categoriesChart.setOption(categoriesOption); </script> {% endraw %}
|