qianlishi 4 years ago
parent ad756a2ae0
commit 79d30d2516

@ -331,6 +331,12 @@ export default {
},
mounted() {},
methods: {
onJsonChange(val) {
console.log(val);
},
onJsonSave(val) {
console.log(val);
},
//
changed(val, key) {
if (val.extend) {

@ -1822,7 +1822,7 @@ const widgetTools = [
placeholder: 'px',
relactiveDom: 'dataType',
relactiveDomValue: 'staticData',
value: '{"categories": ["苹果","三星","小米","oppo","vivo"],"series": [{"name": "手机品牌","data": [1000,2229,3879,2379,4079]}]}',
value: {"categories": ["苹果","三星","小米","oppo","vivo"],"series": [{"name": "手机品牌","data": [1000,2229,3879,2379,4079]}]},
},
{
type: 'dycustComponents',
@ -2360,7 +2360,7 @@ const widgetTools = [
placeholder: 'px',
relactiveDom: 'dataType',
relactiveDomValue: 'staticData',
value: '{"categories": ["苹果","三星","小米","oppo","vivo"],"series": [{"name": "手机品牌","data": [1000,2229,3879,2379,4079]}]}',
value: {"categories": ["苹果","三星","小米","oppo","vivo"],"series": [{"name": "手机品牌","data": [1000,2229,3879,2379,4079]}]},
},
{
type: 'dycustComponents',
@ -3003,7 +3003,7 @@ const widgetTools = [
placeholder: 'px',
relactiveDom: 'dataType',
relactiveDomValue: 'staticData',
value: '{"categories": ["苹果","三星","小米","oppo","vivo"],"series": [{"name": "手机品牌","data": [1009,3409,2309,5409,3409]}]}',
value: {"categories": ["苹果","三星","小米","oppo","vivo"],"series": [{"name": "手机品牌","data": [1009,3409,2309,5409,3409]}]},
},
{
type: 'dycustComponents',
@ -3628,7 +3628,7 @@ const widgetTools = [
placeholder: 'px',
relactiveDom: 'dataType',
relactiveDomValue: 'staticData',
value: '{"xAxis": ["1月", "2月", "3月", "4月", "5月","6月", "7月", "8月","9月","10月","11月","12月"],"series": [{"type": "bar","name": "货运量","data": [2.6,5.9,9,26.4,28.7,70.7,175.6,182.2,48.7,18.8,6,2.3]},{"type": "line","name": "货运总量","yAxisIndex": 1,"data": [2,2.2,3.3,4.5,6.3,10.2,20.3,23.4,23,16.5,12,6.2]}]}',
value: {"xAxis": ["1月", "2月", "3月", "4月", "5月","6月", "7月", "8月","9月","10月","11月","12月"],"series": [{"type": "bar","name": "货运量","data": [2.6,5.9,9,26.4,28.7,70.7,175.6,182.2,48.7,18.8,6,2.3]},{"type": "line","name": "货运总量","yAxisIndex": 1,"data": [2,2.2,3.3,4.5,6.3,10.2,20.3,23.4,23,16.5,12,6.2]}]},
},
{
type: 'dycustComponents',
@ -4021,7 +4021,7 @@ const widgetTools = [
placeholder: 'px',
relactiveDom: 'dataType',
relactiveDomValue: 'staticData',
value: '[{"value": 1048,"name": "搜索引擎"},{"value": 735, "name": "直接访问"},{"value": 580, "name": "邮件营销"},{"value": 484,"name":"联盟广告"},{"value":300,"name":"视频广告"}]',
value: [{"value": 1048,"name": "搜索引擎"},{"value": 735, "name": "直接访问"},{"value": 580, "name": "邮件营销"},{"value": 484,"name":"联盟广告"},{"value":300,"name":"视频广告"}]
},
{
type: 'dycustComponents',
@ -4395,7 +4395,7 @@ const widgetTools = [
placeholder: 'px',
relactiveDom: 'dataType',
relactiveDomValue: 'staticData',
value: '[{"value": 60,"name": "访问"},{"value": 40, "name": "咨询"},{"value": 20, "name": "订单"},{"value": 80,"name":"点击"},{"value":100,"name":"展现"}]',
value: [{"value": 60,"name": "访问"},{"value": 40, "name": "咨询"},{"value": 20, "name": "订单"},{"value": 80,"name":"点击"},{"value":100,"name":"展现"}],
},
{
type: 'dycustComponents',
@ -4548,7 +4548,7 @@ const widgetTools = [
placeholder: 'px',
relactiveDom: 'dataType',
relactiveDomValue: 'staticData',
value: '{"value": 50, "name": "名称", "unit": "%"}',
value: {value: 50, name: "名称", unit: "%"},
},
{
type: 'dycustComponents',
@ -4995,7 +4995,7 @@ const widgetTools = [
placeholder: 'px',
relactiveDom: 'dataType',
relactiveDomValue: 'staticData',
value: '[{"value": 1048,"name": "搜索引擎"},{"value": 735, "name": "直接访问"},{"value": 580, "name": "邮件营销"},{"value": 484,"name":"联盟广告"},{"value":300,"name":"视频广告"}]',
value: [{"value": 1048,"name": "搜索引擎"},{"value": 735, "name": "直接访问"},{"value": 580, "name": "邮件营销"},{"value": 484,"name":"联盟广告"},{"value":300,"name":"视频广告"}],
},
{
type: 'dycustComponents',

@ -95,7 +95,12 @@ export default {
barWidth: "20px",
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "rgba(0,244,255,1)" // 0%
@ -115,9 +120,9 @@ export default {
label: {
normal: {
show: true,
position: ['-10', '-30'],
position: ["-10", "-30"],
distance: 1,
formatter: '{a|{c}}',
formatter: "{a|{c}}",
rich: {
a: {
fontSize: 15,
@ -328,9 +333,14 @@ export default {
//
setOptionsColor() {
const optionsCollapse = this.optionsSetup;
const itemStyle = this.options.series[0]['itemStyle']
const itemStyle = this.options.series[0]["itemStyle"];
const normal = {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: optionsCollapse.bar0color // 0%
@ -345,8 +355,8 @@ export default {
barBorderRadius: optionsCollapse.radius, //
shadowColor: optionsCollapse.shadowColor, //
shadowBlur: optionsCollapse.shadowBlur //
}
itemStyle['normal'] = normal
};
itemStyle["normal"] = normal;
},
//
setOptionsData() {
@ -362,7 +372,7 @@ export default {
},
//
staticDataFn(val, optionsSetup) {
const staticData = JSON.parse(val);
const staticData = typeof val == "string" ? JSON.parse(val) : val;
// x
if (optionsSetup.verticalShow) {
this.options.xAxis.data = [];

@ -1,7 +1,6 @@
<template>
<div :style="styleObj">
<v-chart :options="options"
autoresize />
<v-chart :options="options" autoresize />
</div>
</template>
@ -90,7 +89,7 @@ export default {
},
// "area" "radius"
setOptionsRosetype() {
this.options.series[0]['roseType'] = this.optionsSetup.nightingleRosetype
this.options.series[0]["roseType"] = this.optionsSetup.nightingleRosetype;
},
//
setOptionsTitle() {
@ -202,7 +201,7 @@ export default {
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const staticData = JSON.parse(val);
const staticData = typeof val == "string" ? JSON.parse(val) : val;
for (const key in this.options.series) {
if (this.options.series[key].type == "pie") {
this.options.series[key].data = staticData;

@ -296,7 +296,7 @@ export default {
},
//
staticDataFn(val, optionsSetup) {
const staticData = JSON.parse(val);
const staticData = typeof val == "string" ? JSON.parse(val) : val;
// x
if (optionsSetup.verticalShow) {
this.options.xAxis.data = [];

@ -383,7 +383,7 @@ export default {
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const staticData = JSON.parse(val);
const staticData = typeof val == "string" ? JSON.parse(val) : val;
// x
this.options.xAxis.data = staticData.xAxis;
// series

@ -204,7 +204,7 @@ export default {
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const staticData = JSON.parse(val);
const staticData = typeof val == "string" ? JSON.parse(val) : val;
for (const key in this.options.series) {
if (this.options.series[key].type == "funnel") {
this.options.series[key].data = staticData;

@ -102,24 +102,22 @@ export default {
},
setOptionsData() {
const optionsData = this.optionsData; // or
console.log(optionsData);
optionsData.dataType == "staticData"
? this.staticDataFn(optionsData.staticData)
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const unit = JSON.parse(val).unit;
const staticData = typeof val == "string" ? JSON.parse(val) : val;
const series = this.options.series;
for (const key in series) {
series[key].detail.formatter = `{value}${unit}`;
series[key].detail.formatter = `{value}${staticData.unit}`;
series[key].data[0] = {
value: JSON.parse(val).value,
name: JSON.parse(val).name
value: staticData.value,
name: staticData.name
};
}
},
dynamicDataFn(val, refreshTime) {
console.log(val);
if (!val) return;
if (this.ispreview) {
this.getEchartData(val);

@ -297,7 +297,7 @@ export default {
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const staticData = JSON.parse(val);
const staticData = typeof val == "string" ? JSON.parse(val) : val;
// x
this.options.xAxis.data = staticData.categories;
// series

@ -95,10 +95,11 @@ export default {
//
setOptionsPiechartStyle() {
if (this.optionsSetup.piechartStyle == "shixin") {
this.options.series[0]['radius'] = "50%"
this.options.series[0]["radius"] = "50%";
} else if (this.optionsSetup.piechartStyle == "kongxin") {
this.options.series[0]['radius'] = ["40%", "70%"]
}else {}
this.options.series[0]["radius"] = ["40%", "70%"];
} else {
}
},
//
setOptionsTitle() {
@ -197,7 +198,7 @@ export default {
: this.dynamicDataFn(optionsData.dynamicData, optionsData.refreshTime);
},
staticDataFn(val) {
const staticData = JSON.parse(val);
const staticData = typeof val == "string" ? JSON.parse(val) : val;
for (const key in this.options.series) {
if (this.options.series[key].type == "pie") {
this.options.series[key].data = staticData;

Loading…
Cancel
Save