feat--词云图、热力图系列更新

This commit is contained in:
qianming
2023-12-15 16:31:28 +08:00
parent 81ad917294
commit 737bb024d7
4 changed files with 996 additions and 268 deletions

View File

@@ -30,7 +30,7 @@ export const widgetWordCloud = {
{
type: 'el-switch',
label: '标题显示',
name: 'isNoTitle',
name: 'isShowTitle',
required: false,
placeholder: '',
value: true,
@@ -38,7 +38,7 @@ export const widgetWordCloud = {
{
type: 'el-input-text',
label: '标题名',
name: 'titleText',
name: 'text',
required: false,
placeholder: '',
value: '',
@@ -66,10 +66,10 @@ export const widgetWordCloud = {
required: false,
placeholder: '',
selectOptions: [
{ code: 'normal', name: '正常' },
{ code: 'bold', name: '粗体' },
{ code: 'bolder', name: '特粗体' },
{ code: 'lighter', name: '细体' }
{code: 'normal', name: '正常'},
{code: 'bold', name: '粗体'},
{code: 'bolder', name: '特粗体'},
{code: 'lighter', name: '细体'}
],
value: 'normal'
},
@@ -80,29 +80,30 @@ export const widgetWordCloud = {
required: false,
placeholder: '',
selectOptions: [
{ code: 'normal', name: '正常' },
{ code: 'italic', name: 'italic斜体' },
{ code: 'oblique', name: 'oblique斜体' },
{code: 'normal', name: '正常'},
{code: 'italic', name: 'italic斜体'},
{code: 'oblique', name: 'oblique斜体'},
],
value: 'normal'
},
{
type: 'el-select',
label: '字体位置',
name: 'textAlign',
label: '字体系列',
name: 'textFontFamily',
required: false,
placeholder: '',
selectOptions: [
{ code: 'center', name: '居中' },
{ code: 'left', name: '左对齐' },
{ code: 'right', name: '右对齐' },
{code: 'sans-serif', name: 'sans-serif'},
{code: 'serif', name: 'serif'},
{code: 'Arial', name: 'Arial'},
{code: 'Courier New', name: 'Courier New'},
],
value: 'center'
value: 'sans-serif'
},
{
type: 'el-input-text',
label: '副标题名',
name: 'subText',
name: 'subtext',
required: false,
placeholder: '',
value: ''
@@ -110,7 +111,7 @@ export const widgetWordCloud = {
{
type: 'vue-color',
label: '字体颜色',
name: 'subTextColor',
name: 'subtextColor',
required: false,
placeholder: '',
value: 'rgba(30, 144, 255, 1)'
@@ -118,7 +119,7 @@ export const widgetWordCloud = {
{
type: 'el-input-number',
label: '字体字号',
name: 'subTextFontSize',
name: 'subtextFontSize',
required: false,
placeholder: '',
value: 20
@@ -126,30 +127,73 @@ export const widgetWordCloud = {
{
type: 'el-select',
label: '字体粗细',
name: 'subTextFontWeight',
name: 'subtextFontWeight',
required: false,
placeholder: '',
selectOptions: [
{ code: 'normal', name: '正常' },
{ code: 'bold', name: '粗体' },
{ code: 'bolder', name: '特粗体' },
{ code: 'lighter', name: '细体' }
{code: 'normal', name: '正常'},
{code: 'bold', name: '粗体'},
{code: 'bolder', name: '特粗体'},
{code: 'lighter', name: '细体'}
],
value: 'normal'
},
{
type: 'el-select',
label: '字体风格',
name: 'subTextFontStyle',
name: 'subtextFontStyle',
required: false,
placeholder: '',
selectOptions: [
{ code: 'normal', name: '正常' },
{ code: 'italic', name: 'italic斜体' },
{ code: 'oblique', name: 'oblique斜体' },
{code: 'normal', name: '正常'},
{code: 'italic', name: 'italic斜体'},
{code: 'oblique', name: 'oblique斜体'},
],
value: 'normal'
},
{
type: 'el-select',
label: '字体系列',
name: 'subtextFontFamily',
required: false,
placeholder: '',
selectOptions: [
{code: 'sans-serif', name: 'sans-serif'},
{code: 'serif', name: 'serif'},
{code: 'Arial', name: 'Arial'},
{code: 'Courier New', name: 'Courier New'},
],
value: 'sans-serif'
},
{
type: 'el-select',
label: '左右位置',
name: 'titleLeft',
required: false,
placeholder: '',
selectOptions: [
{code: 'center', name: '居中'},
{code: 'left', name: '左对齐'},
{code: 'right', name: '右对齐'},
],
value: 'center'
},
{
type: 'el-slider',
label: '上下间距',
name: 'titleTop',
required: false,
placeholder: '',
value: 5,
},
{
type: 'el-input-number',
label: '主副标题间距',
name: 'titleItemGap',
required: false,
placeholder: '',
value: 0
},
],
},
{
@@ -197,10 +241,18 @@ export const widgetWordCloud = {
{
name: '提示语设置',
list: [
{
type: 'el-switch',
label: '显示',
name: 'isShowTooltip',
required: false,
placeholder: '',
value: true
},
{
type: 'el-input-number',
label: '字体字号',
name: 'tipsFontSize',
name: 'tooltipFontSize',
required: false,
placeholder: '',
value: 16
@@ -208,11 +260,52 @@ export const widgetWordCloud = {
{
type: 'vue-color',
label: '字体颜色',
name: 'tipsColor',
name: 'tooltipColor',
required: false,
placeholder: '',
value: '#00FEFF'
},
{
type: 'el-select',
label: '字体粗细',
name: 'tooltipFontWeight',
required: false,
placeholder: '',
selectOptions: [
{code: 'normal', name: '正常'},
{code: 'bold', name: '粗体'},
{code: 'bolder', name: '特粗体'},
{code: 'lighter', name: '细体'}
],
value: 'normal'
},
{
type: 'el-select',
label: '字体风格',
name: 'tooltipFontStyle',
required: false,
placeholder: '',
selectOptions: [
{code: 'normal', name: '正常'},
{code: 'italic', name: 'italic斜体'},
{code: 'oblique', name: 'oblique斜体'},
],
value: 'normal'
},
{
type: 'el-select',
label: '字体系列',
name: 'tooltipFontFamily',
required: false,
placeholder: '',
selectOptions: [
{code: 'sans-serif', name: 'sans-serif'},
{code: 'serif', name: 'serif'},
{code: 'Arial', name: 'Arial'},
{code: 'Courier New', name: 'Courier New'},
],
value: 'sans-serif'
},
],
},
],

View File

@@ -1,6 +1,6 @@
<template>
<div :style="styleObj">
<v-chart ref="myVChart" :options="options" autoresize />
<v-chart ref="myVChart" :options="options" autoresize/>
</div>
</template>
@@ -152,27 +152,33 @@ export default {
this.setOptionsSeries();
this.setOptionsMargin();
this.setOptionsVisualMap();
this.setOptionsTooltip();
this.setOptionsData();
},
// 标题修改
setOptionsTitle() {
const optionsSetup = this.optionsSetup;
const title = {};
title.text = optionsSetup.titleText;
title.show = optionsSetup.isNoTitle;
title.left = optionsSetup.textAlign;
title.textStyle = {
color: optionsSetup.textColor,
fontSize: optionsSetup.textFontSize,
fontWeight: optionsSetup.textFontWeight,
fontStyle: optionsSetup.textFontStyle,
};
title.subtext = optionsSetup.subText;
title.subtextStyle = {
color: optionsSetup.subTextColor,
fontWeight: optionsSetup.subTextFontWeight,
fontSize: optionsSetup.subTextFontSize,
fontStyle: optionsSetup.subTextFontStyle,
const title = {
text: optionsSetup.text,
show: optionsSetup.isShowTitle,
left: optionsSetup.titleLeft,
top: optionsSetup.titleTop + "%",
itemGap: optionsSetup.titleItemGap,
textStyle: {
color: optionsSetup.textColor,
fontSize: optionsSetup.textFontSize,
fontWeight: optionsSetup.textFontWeight,
fontStyle: optionsSetup.textFontStyle,
fontFamily: optionsSetup.textFontFamily,
},
subtext: optionsSetup.subtext,
subtextStyle: {
color: optionsSetup.subtextColor,
fontWeight: optionsSetup.subtextFontWeight,
fontSize: optionsSetup.subtextFontSize,
fontStyle: optionsSetup.subtextFontStyle,
fontFamily: optionsSetup.subtextFontFamily
},
};
this.options.title = title;
},
@@ -182,34 +188,59 @@ export default {
const xAxis = {
type: "category",
// 坐标轴是否显示
show: optionsSetup.hideX,
show: optionsSetup.isShowX,
position: optionsSetup.positionX,
offset: optionsSetup.offsetX,
// 坐标轴名称
name: optionsSetup.nameX,
nameLocation: optionsSetup.nameLocationX,
nameTextStyle: {
color: optionsSetup.nameColorX,
fontSize: optionsSetup.nameFontSizeX,
fontWeight: optionsSetup.nameFontWeightX,
fontStyle: optionsSetup.nameFontStyleX,
fontFamily: optionsSetup.nameFontFamilyX,
},
// 轴反转
inverse: optionsSetup.reversalX,
axisLabel: {
show: true,
// 文字间隔
interval: optionsSetup.textInterval,
show: optionsSetup.isShowAxisLabelX,
interval: optionsSetup.textIntervalX,
// 文字角度
rotate: optionsSetup.textAngleX,
textStyle: {
// 坐标文字颜色
color: optionsSetup.colorX,
fontSize: optionsSetup.fontSizeX,
color: optionsSetup.textColorX,
fontSize: optionsSetup.textFontSizeX,
fontWeight: optionsSetup.textFontWeightX,
fontStyle: optionsSetup.textFontStyleX,
fontFamily: optionsSetup.textFontFamilyX,
},
},
// X轴线
axisLine: {
show: true,
show: optionsSetup.isShowAxisLineX,
lineStyle: {
color: optionsSetup.lineColorX,
width: optionsSetup.lineWidthX,
},
},
// X轴刻度线
axisTick: {
show: optionsSetup.isShowAxisLineX,
lineStyle: {
color: optionsSetup.lineColorX,
width: optionsSetup.lineWidthX,
},
},
// X轴分割线
splitLine: {
show: optionsSetup.isShowSplitLineX,
lineStyle: {
color: optionsSetup.splitLineColorX,
width: optionsSetup.splitLineWidthX,
},
},
};
this.options.xAxis = xAxis;
},
@@ -217,52 +248,79 @@ export default {
setOptionsY() {
const optionsSetup = this.optionsSetup;
const yAxis = {
type: "value",
max: optionsSetup.maxY !== "" ? optionsSetup.maxY : null,
type: "category",
scale: optionsSetup.scale,
// 均分
splitNumber: optionsSetup.splitNumberY,
// 坐标轴是否显示
show: optionsSetup.isShowY,
position: optionsSetup.positionY,
offset: optionsSetup.offsetY,
// 坐标轴名称
name: optionsSetup.textNameY,
nameLocation: optionsSetup.nameLocationY,
nameTextStyle: {
color: optionsSetup.nameColorY,
fontSize: optionsSetup.nameFontSizeY,
fontWeight: optionsSetup.nameFontWeightY,
fontStyle: optionsSetup.nameFontStyleY,
fontFamily: optionsSetup.nameFontFamilyY,
},
// 轴反转
inverse: optionsSetup.reversalY,
axisLabel: {
show: true,
show: optionsSetup.isShowAxisLabelY,
// 文字角度
rotate: optionsSetup.textAngleY,
//interval: optionsSetup.textIntervalY,
textStyle: {
// 坐标文字颜色
color: optionsSetup.colorY,
fontSize: optionsSetup.fontSizeY,
color: optionsSetup.textColorY,
fontSize: optionsSetup.textFontSizeY,
fontWeight: optionsSetup.textFontWeightY,
fontStyle: optionsSetup.textFontStyleY,
fontFamily: optionsSetup.textFontFamilyY,
},
},
axisLine: {
show: true,
show: optionsSetup.isShowAxisLineY,
lineStyle: {
color: optionsSetup.lineColorY,
width: optionsSetup.lineWidthY,
},
},
axisTick: {
show: optionsSetup.isShowAxisLineY,
lineStyle: {
color: optionsSetup.lineColorY,
width: optionsSetup.lineWidthY,
},
},
splitLine: {
show: optionsSetup.isShowSplitLineY,
lineStyle: {
color: optionsSetup.splitLineColorY,
width: optionsSetup.splitLineWidthY,
},
},
};
this.options.yAxis = yAxis;
},
// 数值设定
setOptionsSeries() {
const optionsSetup = this.optionsSetup;
const lable = {
const label = {
show: optionsSetup.isShow,
textStyle: {
fontSize: optionsSetup.fontSize,
color: optionsSetup.dataColor,
fontWeight: optionsSetup.fontWeight,
},
position: optionsSetup.fontPosition,
distance: optionsSetup.fontDistance,
fontSize: optionsSetup.fontSize,
color: optionsSetup.fontColor,
fontWeight: optionsSetup.fontWeight,
fontStyle: optionsSetup.fontStyle,
fontFamily: optionsSetup.fontFamily,
};
this.options.series[0].label = lable;
this.options.series[0].label = label;
},
// 边距设置
setOptionsMargin() {
@@ -282,33 +340,51 @@ export default {
const tooltip = {
trigger: "item",
position: "top",
show: true,
show: optionsSetup.isShowTooltip,
textStyle: {
color: optionsSetup.tipsColor,
fontSize: optionsSetup.tipsFontSize,
color: optionsSetup.tooltipColor,
fontSize: optionsSetup.tooltipFontSize,
fontWeight: optionsSetup.tooltipFontWeight,
fontStyle: optionsSetup.tooltipFontStyle,
fontFamily: optionsSetup.tooltipFontFamily,
},
formatter: function (params) {
if (params.value.length > 1) {
return '坐标:' + params.data[0] + ',' + params.data[1] + '<br/>' + '数值:' + params.data[2];
}
}
};
this.options.tooltip = tooltip;
},
// 图设置
setOptionsVisualMap() {
const optionsSetup = this.optionsSetup;
const visualMap = this.options.visualMap;
visualMap.show = optionsSetup.isShowLegend;
visualMap.min = optionsSetup.dataMin;
visualMap.max = optionsSetup.dataMax;
visualMap.textStyle = {
fontSize: optionsSetup.legendFontSize,
color: optionsSetup.legendColor,
const visualMap = {
show: optionsSetup.isShowLegend,
type: optionsSetup.visualMapType,
min: optionsSetup.dataMin,
max: optionsSetup.dataMax,
calculable: true,
inRange: {
color: optionsSetup.legendColorList.map((x) => {
return x.color;
}),
},
left: optionsSetup.lateralPosition,
top: optionsSetup.longitudinalPosition,
bottom: optionsSetup.longitudinalPosition,
orient: optionsSetup.layoutFront,
textStyle: {
color: optionsSetup.legendColor,
fontSize: optionsSetup.legendFontSize,
fontWeight: optionsSetup.legendFontWeight,
fontStyle: optionsSetup.legendFontStyle,
fontFamily: optionsSetup.legendFontFamily,
},
itemHeight: optionsSetup.legendHeight,
itemWidth: optionsSetup.legendWidth,
};
visualMap.inRange.color = optionsSetup.legendColorList.map((x) => {
return x.color;
});
visualMap.left = optionsSetup.lateralPosition;
visualMap.top = optionsSetup.longitudinalPosition;
visualMap.bottom = optionsSetup.longitudinalPosition;
visualMap.orient = optionsSetup.layoutFront;
visualMap.itemWidth = optionsSetup.legendWidth;
this.options.visualMap = visualMap;
},
setOptionsData(e, paramsConfig) {
const optionsData = this.optionsData; // 数据类型 静态 or 动态

View File

@@ -105,22 +105,27 @@ export default {
// 标题修改
setOptionsTitle() {
const optionsSetup = this.optionsSetup;
const title = {};
title.text = optionsSetup.titleText;
title.show = optionsSetup.isNoTitle;
title.left = optionsSetup.textAlign;
title.textStyle = {
color: optionsSetup.textColor,
fontSize: optionsSetup.textFontSize,
fontWeight: optionsSetup.textFontWeight,
fontStyle: optionsSetup.textFontStyle,
};
title.subtext = optionsSetup.subText;
title.subtextStyle = {
color: optionsSetup.subTextColor,
fontWeight: optionsSetup.subTextFontWeight,
fontSize: optionsSetup.subTextFontSize,
fontStyle: optionsSetup.subTextFontStyle,
const title = {
text: optionsSetup.text,
show: optionsSetup.isShowTitle,
left: optionsSetup.titleLeft,
top: optionsSetup.titleTop + "%",
itemGap: optionsSetup.titleItemGap,
textStyle: {
color: optionsSetup.textColor,
fontSize: optionsSetup.textFontSize,
fontWeight: optionsSetup.textFontWeight,
fontStyle: optionsSetup.textFontStyle,
fontFamily: optionsSetup.textFontFamily,
},
subtext: optionsSetup.subtext,
subtextStyle: {
color: optionsSetup.subtextColor,
fontWeight: optionsSetup.subtextFontWeight,
fontSize: optionsSetup.subtextFontSize,
fontStyle: optionsSetup.subtextFontStyle,
fontFamily: optionsSetup.subtextFontFamily
},
};
this.options.title = title;
},
@@ -145,10 +150,13 @@ export default {
const optionsSetup = this.optionsSetup;
const tooltip = {
trigger: "item",
show: true,
show: optionsSetup.isShowTooltip,
textStyle: {
color: optionsSetup.tipsColor,
fontSize: optionsSetup.tipsFontSize,
color: optionsSetup.tooltipColor,
fontSize: optionsSetup.tooltipFontSize,
fontWeight: optionsSetup.tooltipFontWeight,
fontStyle: optionsSetup.tooltipFontStyle,
fontFamily: optionsSetup.tooltipFontFamily,
},
};
this.options.tooltip = tooltip;