Ver código fonte

完善图表显示值功能

master
youseries 6 anos atrás
pai
commit
f78d9cc15a
  1. 2
      ureport2-console/src/main/resources/ureport-asserts/js/designer.bundle.js
  2. 2
      ureport2-console/src/main/resources/ureport-asserts/js/preview.bundle.js
  3. 9
      ureport2-js/src/Utils.js
  4. 2
      ureport2-js/src/panel/property/chart/BarChartValueEditor.js
  5. 34
      ureport2-js/src/panel/property/chart/ChartValueEditor.js

2
ureport2-console/src/main/resources/ureport-asserts/js/designer.bundle.js

File diff suppressed because one or more lines are too long

2
ureport2-console/src/main/resources/ureport-asserts/js/preview.bundle.js

File diff suppressed because one or more lines are too long

9
ureport2-js/src/Utils.js

@ -332,9 +332,12 @@ export function tableToXml(context){
cellXml+=`/>`;
}
}
const dataLabels=chart.dataLabels;
if(dataLabels){
cellXml+=`<plugin name="data-labels" display="${dataLabels.display}"/>`;
const plugins=chart.plugins || [];
for(let plugin of plugins){
cellXml+=`<plugin name="${plugin.name}" display="${plugin.display}"/>`;
}
if(plugins){
}
cellXml+=`</chart-value>`;
}

2
ureport2-js/src/panel/property/chart/BarChartValueEditor.js

@ -107,7 +107,7 @@ export default class BarChartValueEditor extends CategoryChartValueEditor{
this.hideDataLabelsRadio.children('input').attr('checked',true);
const plugins=chart.plugins || [];
for(let plugin of plugins){
if(plugin.name==='dataLabels' && plugin.display){
if(plugin.name==='data-labels' && plugin.display){
this.showDataLabelsRadio.children('input').attr('checked',true);
}
}

34
ureport2-js/src/panel/property/chart/ChartValueEditor.js

@ -185,20 +185,14 @@ export default class ChartValueEditor{
this.showDataLabelsRadio=$(`<label class="checkbox-inline" style="padding-left: 2px"><input type="radio" name="__show_datalabels_radio_${this.id}" value="asc">${window.i18n.chart.yes}</label>`);
displayGroup.append(this.showDataLabelsRadio);
this.showDataLabelsRadio.children('input').click(function () {
const chart=_this.cellDef.value.chart;
chart.dataLabels={
name:"data-labels",
display:true
};
const dataLabels=_this.getTargetPlugin("data-labels");
dataLabels.display=true;
});
this.hideDataLabelsRadio=$(`<label class="checkbox-inline" style="padding-left: 2px"><input type="radio" name="__show_datalabels_radio_${this.id}" value="asc" checked>${window.i18n.chart.no}</label>`);
displayGroup.append(this.hideDataLabelsRadio);
this.hideDataLabelsRadio.children('input').click(function () {
const chart=_this.cellDef.value.chart;
chart.dataLabels={
name:"data-labels",
display:false
};
const dataLabels=_this.getTargetPlugin("data-labels");
dataLabels.display=false;
});
}
@ -288,6 +282,26 @@ export default class ChartValueEditor{
this.titlePositionGroup.hide();
}
getTargetPlugin(name){
let plugins=this.cellDef.value.chart.plugins;
if(!plugins){
plugins=[];
this.cellDef.value.chart.plugins=plugins;
}
let targetPlugin=null;
for(let plugin of plugins){
if(plugin.name===name){
targetPlugin=plugin;
break;
}
}
if(!targetPlugin){
targetPlugin={name:name,display:false};
plugins.push(targetPlugin);
}
return targetPlugin;
}
getTargetOption(type){
let options=this.cellDef.value.chart.options;
if(!options){

Carregando…
Cancelar
Salvar