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) { 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, }, 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 function getCategoryAxis(data: string[] | 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: 40, 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 getPyramidYAxis(data: string[] | string[][]) { const categoryAxis = [{ type: 'category', axisTick: { show: false }, axisLine: { lineStyle: { color: '#ccd6ed' } }, axisLabel: { fontSize: 11, color: '#666' }, data: data }, { type: 'category', axisTick: { show: false }, axisLine: { lineStyle: { color: '#ccd6ed' } }, axisLabel: { fontSize: 11, color: '#666' }, data: data }] return categoryAxis }