123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- function loadBlock1() {
- const block1 = echarts.init(document.getElementById("block1"), "shine");
- const block1Opt = {
- tooltip: {
- trigger: "axis",
- formatter: function (params) {
- const param = params[0];
- const marker = '<span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#e6b600;"></span>';
- return param.name + "<br />" +
- marker + "案件数量:" + param.value + " 件";
- }
- },
- grid: {
- top: '35%',
- left: '10%',
- containLabel: true,
- width: "80%",
- height: "60%"
- },
- xAxis: [{
- type: 'category',
- boundaryGap: false,
- axisLine: {
- show: true,
- lineStyle: {
- color: '#233e64'
- },
- },
- axisLabel: {
- textStyle: {
- color: '#6a9cd5',
- margin: 15,
- },
- },
- axisTick: {
- show: false,
- }
- }],
- yAxis: [{
- type: 'value',
- splitNumber: 2,
- splitLine: {
- show: true,
- lineStyle: {
- color: '#233e64'
- }
- },
- axisLine: {
- show: false,
- },
- axisLabel: {
- margin: 5,
- textStyle: {
- color: '#6a9cd5',
- },
- },
- axisTick: {
- show: false,
- }
- }],
- series: [{
- name: '案件数量',
- type: 'line',
- smooth: true,
-
- symbolSize: 0,
- lineStyle: {
- normal: {
- color: "#3deaff"
- }
- },
- areaStyle: {
- normal: {
-
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
- offset: 0,
- color: 'rgba(61,234,255, 0.9)'
- },
- {
- offset: 1,
- color: 'rgba(61,234,255, 0)'
- }
- ], false),
- shadowColor: 'rgba(53,142,215, 0.9)',
- shadowBlur: 20
- }
- },
- }]
- };
- block1.setOption(block1Opt);
- $.ajax({
- url: ajaxBaseUrl + "data/case.json",
- dataType: "json"
- }).done(function () {
- $("#block1").addClass("chart-done");
- }).done(function (data) {
- const xData = [];
- const yData = [];
- for (let i in data) {
- xData.push(data[i].date);
- yData.push(data[i].total);
- }
- block1.setOption({
- xAxis: {
- data: xData
- },
- series: [{
- name: "案件数量",
- data: yData
- }]
- });
- }).fail(function (jqXHR) {
- console.log("Ajax Fail: ", jqXHR.status, jqXHR.statusText);
- });
- }
|