// export const columnChart_xAxis = { // type: 'category', // axisTick: { // show: false, // }, // axisLine: { // lineStyle: { // color: '#ccd6eb' // } // }, // axisLabel: { // fontSize: 11, // color: '#666666' // }, // data: [] // } // export const barChart_xAxis = { // type: 'value', // name: "", // nameLocation: 'center', // nameTextStyle: { // color: '#666666', // fontSize: 12 // }, // nameGap: 30, // axisLine: { // show: false // }, // min: function (value) { // if (value.min !== Infinity && value.min > 5) { // return Math.ceil(value.min - 5); // } else { // return 0 // } // }, // label: { // show: true, // }, // axisTick: { // show: false, // length: 10 // }, // axisLabel: { // fontSize: 11, // color: '#666666' // }, // splitLine: { // lineStyle: { // color: '#e6e6e6' // } // } // } export const getXaxisOfCategory = function (xAxisName: string, xAxisDatas: any[]) { console.log("xAxisDatas", xAxisDatas); let paramJsonObj = [ { name: xAxisName, type: "category", data: xAxisDatas, // X轴线设置 axisLine: { show: true, lineStyle: { opacity: 0.8, color: "#ccd6eb", width: 1, }, }, // X轴线刻度设置 axisTick: { show: false, length: 8, lineStyle: { opacity: 0.8, color: "#ccd6eb", width: 1, }, alignWithLabel: true, }, // X轴线标签设置 axisLabel: { show: true, color: "#666666", fontSize: 11, }, splitLine: { show: false } }, ] return paramJsonObj; } // 带有刻度线 export const getXaxisOfCategoryTick = function (xAxisName: string, xAxisDatas: any[]) { let paramJsonObj = [ { name: xAxisName, type: "category", data: xAxisDatas, // X轴线设置 axisLine: { show: true, lineStyle: { opacity: 0.8, color: "#ccd6eb", width: 1, }, }, // X轴线刻度设置 axisTick: { show: true, length: 8, lineStyle: { opacity: 0.8, color: "#ccd6eb", width: 1, }, alignWithLabel: true, }, // X轴线标签设置 axisLabel: { show: true, color: "#666666", fontSize: 11, }, splitLine: { show: false } }, ] return paramJsonObj; } export const getXaxisOfCategoryNoXDatas = function(xAxisName: string) { let paramJsonObj = [ { name: xAxisName, type: "category", // X轴线设置 axisLine: { show: true, lineStyle: { opacity: 0.8, color: "#ccd6eb", width: 1, }, }, // X轴线刻度设置 axisTick: { show: true, length: 8, lineStyle: { opacity: 0.8, color: "#ccd6eb", width: 1, }, alignWithLabel: true, }, // X轴线标签设置 axisLabel: { show: true, color: "#666666", fontSize: 11, }, splitLine: { show: false } }, ] return paramJsonObj; } // 时间轴 export const getXaxisOfTime = function (xAxisName: string) { let paramJsonObj = [ { name: xAxisName, type: "time", minInterval: 1, maxInterval: 3600 * 24 * 100, // X轴线设置 axisLine: { show: true, lineStyle: { opacity: 0.8, color: "#ccd6eb", width: 1, }, }, // X轴线刻度设置 axisTick: { show: true, length: 8, lineStyle: { opacity: 0.8, color: "#ccd6eb", width: 1, }, alignWithLabel: true, }, // X轴线标签设置 axisLabel: { show: true, color: "#666666", fontSize: 11, }, splitLine: { show: false, }, }, ]; return paramJsonObj; }; export function getCategoryAxis(data: string[]) { const categoryAxis = { type: 'category', axisTick: { show: false }, axisLine: { lineStyle: { color: '#ccd6ed' } }, axisLabel: { fontSize: 11, color: '#666' }, data: data } return categoryAxis } export function getValueAxis(axisName: string) { const valueAxis = { type: 'value', name: axisName, nameLocation: 'center', nameTextStyle: { color: '#666666', fontSize: 12 }, nameGap: 30, axisLine: { show: false }, min: function (value) { if (value.min !== Infinity && value.min > 5) { return Math.ceil(value.min - 5); } else { return 0 } }, label: { show: true, }, axisTick: { show: false, length: 10 }, axisLabel: { fontSize: 11, color: '#666666' }, splitLine: { lineStyle: { color: '#e6e6e6' } } } return valueAxis } export function getPyramidCategoryAxis(axisName) { const valueAxis = { type: 'value', name: axisName, nameLocation: 'center', nameTextStyle: { color: '#666666', fontSize: 12 }, nameGap: 30, axisLine: { show: false }, label: { show: true, }, axisTick: { show: false, length: 10 }, axisLabel: { fontSize: 11, color: '#666666', formatter: function (value) { return Math.abs(value) } }, splitLine: { lineStyle: { color: '#e6e6e6' } } } return valueAxis }