update
This commit is contained in:
@@ -3,7 +3,6 @@ import "./overwrite.css"; // 覆写 antd 默认样式,全局
|
||||
import ReactECharts from "echarts-for-react";
|
||||
import * as echarts from "echarts";
|
||||
import { Switch, Radio } from "antd";
|
||||
import { randomInt } from "../../../../../utils";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
@@ -33,7 +32,7 @@ const GoodRateChart = (props) => {
|
||||
}
|
||||
|
||||
// 根据日期类型,数据列表,是否展示班次数据,生成对应的 options
|
||||
const options = getOptions(cutting.chart[dateType], showMore);
|
||||
const options = getOptions(cutting.chart[dateType], showMore, dateType);
|
||||
|
||||
return (
|
||||
<div className={cls.GoodRateChart}>
|
||||
@@ -80,7 +79,7 @@ const GoodRateChart = (props) => {
|
||||
|
||||
export default GoodRateChart;
|
||||
|
||||
function getOptions(dataList, showMore) {
|
||||
function getOptions(dataList, showMore, dateType) {
|
||||
console.log("showmore", showMore);
|
||||
const list = [...dataList].sort((a, b) => a.dataTime - b.dataTime);
|
||||
// data: Array(7)
|
||||
@@ -97,11 +96,19 @@ function getOptions(dataList, showMore) {
|
||||
const grid = { top: 28, right: 12, bottom: 48, left: 48 };
|
||||
const xAxis = {
|
||||
type: "category",
|
||||
data: list.map((item) => item.dataTime.split("T")[0]),
|
||||
data: list.map((item) =>
|
||||
dateType == "day"
|
||||
? item.dataTime.split("T")[1]
|
||||
: item.dataTime.split("T")[0]
|
||||
),
|
||||
// data: list.map((item) => {
|
||||
// console.log("datetime", item.dataTime);
|
||||
// return item.dataTime.split("T")[0];
|
||||
// }),
|
||||
axisLabel: {
|
||||
color: "#fff",
|
||||
fontSize: 12,
|
||||
rotate: 45,
|
||||
fontSize: 10,
|
||||
rotate: 25,
|
||||
margin: 13,
|
||||
},
|
||||
axisTick: { show: false },
|
||||
@@ -167,13 +174,13 @@ function getOptions(dataList, showMore) {
|
||||
yAxis,
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
color: '#fff',
|
||||
color: "#fff",
|
||||
formatter: "{b} {c}%",
|
||||
axisPointer: {
|
||||
type: "shadow",
|
||||
},
|
||||
textStyle: {
|
||||
color: '#fffc'
|
||||
color: "#fffc",
|
||||
},
|
||||
className: "xc-chart-tooltip",
|
||||
// backgroundColor: ''
|
||||
|
||||
Reference in New Issue
Block a user