// 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[], style: any) { let paramJsonObj = [ { name: xAxisName, nameTextStyle: { fontSize: style.fontSize }, 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: style.fontSize - 1, }, 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 getXaxisOfCategoryTickDefault = (style) => { let paramJsonObj = [ { name: '', type: "category", data: [], // 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: style.fontSize -1 , }, 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 getCategoryXAxis(style, data: string[] = [], name: string = '') { const categoryAxis = { name: name, nameTextStyle: { fontSize: style.fontSize - 1 }, type: 'category', axisTick: { show: false }, axisLine: { lineStyle: { color: '#ccd6ed' } }, axisLabel: { fontSize: style.fontSize - 1, color: '#666' }, data: [] } if (data) { categoryAxis.data = data; } return categoryAxis } export function getValueXAxis(style, axisName: string = "") { const valueAxis = { type: 'value', name: axisName, nameLocation: 'center', nameTextStyle: { color: '#666666', fontSize: style.fontSize - 1 }, 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: style.fontSize - 1, color: '#666666' }, splitLine: { lineStyle: { color: '#e6e6e6' } } } return valueAxis } export function getPyramidCategoryAxis(style, axisName?) { const valueAxis = { type: 'value', name: axisName, nameLocation: 'center', nameTextStyle: { color: '#666666', fontSize: style.fontSize }, nameGap: 30, axisLine: { show: false }, label: { show: true, }, axisTick: { show: false, length: 10 }, axisLabel: { fontSize: style.fontSize - 1, color: '#666666', formatter: function (value) { return Math.abs(value) } }, splitLine: { lineStyle: { color: '#e6e6e6' } } } return valueAxis } //todo 声学分析图x export const getXaxisOfNoiseAnalysisLine = (interval: number, xdata, formatter?) => { const xAxis = [ { axisLabel: { rotate: 30, interval: interval, formatter: formatter ? formatter : function (data) { let valueText = ''; if (data.length > 5) { valueText = data.substring(0, 5) + '...' } else { valueText = data } return valueText; }, textStyle: { fontSize: '100%' } }, name: '', splitLine: { show: true }, data: xdata }, { data: xdata, gridIndex: 1, axisLabel: { interval: interval, formatter: function () { return ""; }, textStyle: { fontSize: '100%' } }, splitLine: { show: true }, axisTick: { show: false }, }, { gridIndex: 1, } ] return xAxis }