export const columnChart_yAxis = { type: 'value', name: "", nameLocation: 'center', nameTextStyle: { color: '#666666', fontSize: 12 }, nameGap: 45, 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 barChart_yAxis = { type: 'category', axisTick: { show: false, }, axisLine: { lineStyle: { color: '#ccd6eb' } }, axisLabel: { fontSize: 11, color: '#666666' }, data: [] } export const getYaxisOfValue = function (style: any, yAxisName: string = '', yNameGap: number = 30) { let paramJsonObj = [ { name: yAxisName, nameTextStyle: { fontSize: style.fontSize, color: "#666666", }, type: "value", nameGap: yNameGap, nameLocation: "middle", // Y轴线设置 axisLine: { show: false, lineStyle: { opacity: 0.2, }, }, // Y轴线刻度设置 axisTick: { show: false, length: 3, lineStyle: { opacity: 0.3, }, }, // Y轴线标签设置 axisLabel: { show: true, fontSize: style.fontSize - 1, }, splitLine: { show: true, lineStyle: { opacity: 0.6, }, }, // Y轴值域动态设置 max: function (value) { if (value.max % 10 !== 0) { return Math.ceil(value.max / 10) * 10; } else { return value.max; } }, min: function (value) { if (value.min % 10 !== 0) { return Math.floor(value.min / 10) * 10; } else { return value.min; } }, }, ]; return paramJsonObj; } export const getYaxisOfValueDefault = (style) => { let paramJsonObj = [ { name: '', nameTextStyle: { fontSize: style.fontSize, color: "#666666", }, type: "value", nameLocation: "middle", // Y轴线设置 axisLine: { show: false, lineStyle: { opacity: 0.2, }, }, // Y轴线刻度设置 axisTick: { show: false, length: 3, lineStyle: { opacity: 0.3, }, }, // Y轴线标签设置 axisLabel: { show: true, fontSize: style.fontSize, }, splitLine: { show: true, lineStyle: { opacity: 0.6, }, }, // Y轴值域动态设置 max: function (value) { if (value.max % 10 !== 0) { return Math.ceil(value.max / 10) * 10; } else { return value.max; } }, min: function (value) { if (value.min % 10 !== 0) { return Math.floor(value.min / 10) * 10; } else { return value.min; } }, }, ]; return paramJsonObj; } export const getYaxisOfValueTranlation = function (style: any, yAxisName: string, yNameGap: number, tranclationnumber: number) { let paramJsonObj = [ { name: yAxisName, nameTextStyle: { fontSize: style.fontSize, color: "#666666", }, type: "value", nameGap: yNameGap, nameLocation: "middle", // Y轴线设置 axisLine: { show: false, lineStyle: { opacity: 0.2, }, }, // Y轴线刻度设置 axisTick: { show: false, length: 3, lineStyle: { opacity: 0.3, }, }, // Y轴线标签设置 axisLabel: { show: true, fontSize: style.fontSize, formatter: function (param) { return param + tranclationnumber; } }, splitLine: { show: true, lineStyle: { opacity: 0.6, }, }, // Y轴值域动态设置 max: function (value) { if (value.max % 10 !== 0) { return Math.ceil(value.max / 10) * 10; } else { return value.max; } }, min: function (value) { if (value.min % 10 !== 0) { return Math.floor(value.min / 10) * 10; } else { return value.min; } }, }, ]; return paramJsonObj; } export const getYaxisOfValueTranlationDefault = function (style: any) { let paramJsonObj = [ { name: '', nameTextStyle: { fontSize: style.fontSize, color: "#666666", }, type: "value", nameGap: 30, nameLocation: "middle", // Y轴线设置 axisLine: { show: false, lineStyle: { opacity: 0.2, }, }, // Y轴线刻度设置 axisTick: { show: false, length: 3, lineStyle: { opacity: 0.3, }, }, // Y轴线标签设置 axisLabel: { show: true, fontSize: style.fontSize, // formatter: function (param) { // return param + tranclationnumber; // } }, splitLine: { show: true, lineStyle: { opacity: 0.6, }, }, // Y轴值域动态设置 max: function (value) { if (value.max % 10 !== 0) { return Math.ceil(value.max / 10) * 10; } else { return value.max; } }, min: function (value) { if (value.min % 10 !== 0) { return Math.floor(value.min / 10) * 10; } else { return value.min; } }, }, ]; return paramJsonObj; } export function getCategoryYAxis(style, data: string[] | string[][] = [], yAxisName: string = "") { const categoryAxis = { type: 'category', name: yAxisName, nameLocation: 'center', nameTextStyle: { color: '#666666', fontSize: style.fontSize }, nameGap: 40, axisTick: { show: false }, axisLine: { lineStyle: { color: '#ccd6ed' } }, axisLabel: { fontSize: style.fontSize - 1, color: '#666' }, data: data } return categoryAxis; } export function getValueYAxis(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 getPyramidYAxis(style, data?: string[] | string[][]) { const categoryAxis = [{ type: 'category', nameLocation: 'center', nameTextStyle: { color: '#666666', fontSize: style.fontSize }, nameGap: 30, axisTick: { show: false }, axisLine: { lineStyle: { color: '#ccd6ed' } }, axisLabel: { fontSize: style.fontSize - 1, color: '#666' }, data: data }, { type: 'category', nameLocation: 'center', nameTextStyle: { color: '#666666', fontSize: style.fontSize - 1 }, nameGap: 30, axisTick: { show: false }, axisLine: { lineStyle: { color: '#ccd6ed' } }, axisLabel: { fontSize: style.fontSize - 1, color: '#666' }, data: data }] if (!data) { categoryAxis[0].data = [] categoryAxis[1].data = [] } return categoryAxis } //todo 声学分析图y export function getYaxisOfNoiseAnalysisLine(categories) { const yAxis = [ { name: 'noise level(dB)', nameLocation: 'middle', nameGap: 30, scale: true, type: 'value', splitNumber: 2, axisLabel: { rotate: 0, fontSize: '100%', formatter: function (data) { let valueText = ''; if (data.length > 5) { valueText = data.substring(0, 5) + '...' } else { valueText = data } return valueText; } }, axisTick: { show: false }, splitLine: { show: true }, }, { axisTick: { show: false }, splitLine: { show: true, interval: 0 }, gridIndex: 1, data: categories }, { gridIndex: 1, }, { show: false, gridIndex: 0, } ] return yAxis }