// 横向legend (基础柱状图) export const horizontal_legend = { top: 'bottom', icon: 'circle', itemGap: 10, itemHeight: 12, textStyle: { fontWeight: 'bold', fontSize: 12, padding: [0, 6, 0, 0] } } // 悬浮块型legend (bar图) export const aboveblock_legend = { top: 'center', orient: 'vertical', right: '5%', icon: 'circle', show: true, data: [], borderWidth: 0.5, backgroundColor: '#fff', borderColor: '#222', border: 1, shadowBlur: 5, shadowColor: 'rgba(0, 0, 0, 0.3)', shadowOffsetX: 2, shadowOffsetY: 2, itemGap: 10, itemHeight: 12, textStyle: { fontWeight: 'bold', fontSize: 12, color: '#333333', padding: [0, 6, 0, 0] } } export const getLegendBottomNoScroll = function (style: any) { let legend = { // type: "scroll", left: "center", bottom: "0%", // icon: "circle", //采用默认symbol作为图例 orient: "horizontal", itemGap: 8, itemWidth: style.fontSize -1, itemHeight: style.fontSize -1, textStyle: { fontSize: style.fontSize -1, fontWeight: 600, padding: [0, 0, 0, 0], } } return legend; } export const getLegendRightScroll = function (style: any) { let legend = { type: "scroll", right: "0%", orient: "vertical", top: "14%", bottom: "12%", width: "100", // icon: "circle", //采用默认symbol作为图例 itemGap: 10, itemWidth: style.fontSize -2, itemHeight: style.fontSize -2, pageIconSize: style.fontSize, pageIcons: { vertical: [ "path://M472.064 272.448l-399.232 399.232c-22.08 22.08-22.08 57.792 0 79.872 22.016 22.016 57.792 22.08 79.872 0L512 392.256l359.296 359.296c22.016 22.016 57.792 22.08 79.872 0 22.08-22.08 22.016-57.792 0-79.872L551.936 272.448C529.856 250.432 494.144 250.432 472.064 272.448z", "path://M472.064 751.552 72.832 352.32c-22.08-22.08-22.08-57.792 0-79.872 22.016-22.016 57.792-22.08 79.872 0L512 631.744l359.296-359.296c22.016-22.016 57.792-22.08 79.872 0 22.08 22.08 22.016 57.792 0 79.872l-399.232 399.232C529.856 773.568 494.144 773.568 472.064 751.552z" ], pageIconColor: "##1D9FC0" }, // pageIcons: // [ // "path://M472.064 272.448l-399.232 399.232c-22.08 22.08-22.08 57.792 0 79.872 22.016 22.016 57.792 22.08 79.872 0L512 392.256l359.296 359.296c22.016 22.016 57.792 22.08 79.872 0 22.08-22.08 22.016-57.792 0-79.872L551.936 272.448C529.856 250.432 494.144 250.432 472.064 272.448z", // "path://M472.064 751.552 72.832 352.32c-22.08-22.08-22.08-57.792 0-79.872 22.016-22.016 57.792-22.08 79.872 0L512 631.744l359.296-359.296c22.016-22.016 57.792-22.08 79.872 0 22.08 22.08 22.016 57.792 0 79.872l-399.232 399.232C529.856 773.568 494.144 773.568 472.064 751.552z" // ], textStyle: { fontSize: style.fontSize, fontWeight: "600", padding: [2, 0, 0, 0], }, } return legend; } export const getLegendNotShow = function (style: any) { let legend = { show: false, type: "scroll", right: "0%", orient: "vertical", top: "14%", bottom: "12%", width: "100", // icon: "circle", //采用默认symbol作为图例 itemGap: 10, itemWidth: style.fontSize -2, itemHeight: style.fontSize -2, pageIconSize: style.fontSize, pageIcons: { vertical: [ "path://M472.064 272.448l-399.232 399.232c-22.08 22.08-22.08 57.792 0 79.872 22.016 22.016 57.792 22.08 79.872 0L512 392.256l359.296 359.296c22.016 22.016 57.792 22.08 79.872 0 22.08-22.08 22.016-57.792 0-79.872L551.936 272.448C529.856 250.432 494.144 250.432 472.064 272.448z", "path://M472.064 751.552 72.832 352.32c-22.08-22.08-22.08-57.792 0-79.872 22.016-22.016 57.792-22.08 79.872 0L512 631.744l359.296-359.296c22.016-22.016 57.792-22.08 79.872 0 22.08 22.08 22.016 57.792 0 79.872l-399.232 399.232C529.856 773.568 494.144 773.568 472.064 751.552z" ], pageIconColor: "##1D9FC0" }, // pageIcons: // [ // "path://M472.064 272.448l-399.232 399.232c-22.08 22.08-22.08 57.792 0 79.872 22.016 22.016 57.792 22.08 79.872 0L512 392.256l359.296 359.296c22.016 22.016 57.792 22.08 79.872 0 22.08-22.08 22.016-57.792 0-79.872L551.936 272.448C529.856 250.432 494.144 250.432 472.064 272.448z", // "path://M472.064 751.552 72.832 352.32c-22.08-22.08-22.08-57.792 0-79.872 22.016-22.016 57.792-22.08 79.872 0L512 631.744l359.296-359.296c22.016-22.016 57.792-22.08 79.872 0 22.08 22.08 22.016 57.792 0 79.872l-399.232 399.232C529.856 773.568 494.144 773.568 472.064 751.552z" // ], textStyle: { fontSize: style.fontSize, fontWeight: "600", padding: [2, 0, 0, 0], }, } return legend; } // 获取横向图例配置 (horizontal_legend) export function getHorizontalLegend() { const horizontal_legend = { top: 'bottom', icon: 'circle', itemGap: 10, itemHeight: 12, textStyle: { fontWeight: 'bold', fontSize: 12, padding: [0, 6, 0, 0] } } return horizontal_legend; } // 获取悬浮图例配置 (bar图) export function getAboveBlock(seriesName: string[]) { const aboveblock_legend = { top: 'center', orient: 'vertical', right: '5%', icon: 'circle', show: true, data: seriesName, borderWidth: 0.5, backgroundColor: '#fff', borderColor: '#222', border: 1, shadowBlur: 5, shadowColor: 'rgba(0, 0, 0, 0.3)', shadowOffsetX: 2, shadowOffsetY: 2, itemGap: 10, itemHeight: 12, textStyle: { fontWeight: 'bold', fontSize: 12, color: '#333333', padding: [0, 6, 0, 0] } } return aboveblock_legend; }