Skip to content

Commit

Permalink
整理dashboardFactory.js、chartFactory.js、chartSetting.js变量定义
Browse files Browse the repository at this point in the history
  • Loading branch information
datageartech committed Jan 30, 2021
1 parent 060166b commit eb1b169
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@

//@deprecated 兼容1.8.1版本的window.chartSetting变量名,未来版本会移除
global.chartForm = chartSetting;
//@deprecated 兼容1.8.1版本的window.chartSetting变量名,未来版本会移除

//@deprecated 兼容2.1.1版本的window.chartFactory.chartSetting变量名,未来版本会移除
chartFactory.chartForm = chartSetting;
//@deprecated 兼容2.1.1版本的window.chartFactory.chartSetting变量名,未来版本会移除
global.chartFactory.chartForm = chartSetting;

//org.datagear.analysis.DataSetParam.DataType
chartSetting.DataSetParamDataType =
Expand Down Expand Up @@ -239,16 +242,16 @@
var styleClassName = chartTheme._dataSetParamValueFormStyleClassName;
if(!styleClassName)
{
styleClassName = global.chartFactory.nextElementId();
styleClassName = chartFactory.nextElementId();
chartTheme._dataSetParamValueFormStyleClassName = styleClassName;
}

$form.addClass(styleClassName);

var styleId = (chartTheme._dataSetParamValueFormStyleSheetId
|| (chartTheme._dataSetParamValueFormStyleSheetId = global.chartFactory.nextElementId()));
|| (chartTheme._dataSetParamValueFormStyleSheetId = chartFactory.nextElementId()));

if(global.chartFactory.isStyleSheetCreated(styleId))
if(chartFactory.isStyleSheetCreated(styleId))
return false;

var qualifier = "." + styleClassName;
Expand Down Expand Up @@ -289,7 +292,7 @@
+" }\n"
;

global.chartFactory.createStyleSheet(styleId, cssText);
chartFactory.createStyleSheet(styleId, cssText);

return true;
};
Expand Down Expand Up @@ -541,7 +544,7 @@
if(optVal == null)
optVal = opt;

var eleId = global.chartFactory.nextElementId();
var eleId = chartFactory.nextElementId();

var $wrapper = $("<div class='dg-dspv-form-radio-wrapper' />").appendTo($inputsWrapper);

Expand Down Expand Up @@ -605,7 +608,7 @@
if(optVal == null)
optVal = opt;

var eleId = global.chartFactory.nextElementId();
var eleId = chartFactory.nextElementId();

var $wrapper = $("<div class='dg-dspv-form-checkbox-wrapper' />").appendTo($inputsWrapper);

Expand Down Expand Up @@ -659,7 +662,7 @@
if(chartTheme)
{
var containerId = (chartTheme._datetimepickerContainerId
|| (chartTheme._datetimepickerContainerId = global.chartFactory.nextElementId()));
|| (chartTheme._datetimepickerContainerId = chartFactory.nextElementId()));
var container = document.getElementById(containerId);
if(!container)
container = $("<div class='dg-dspv-datetimepicker-container' />").attr("id", containerId).appendTo(document.body);
Expand Down Expand Up @@ -727,9 +730,9 @@
chartSetting.datetimepickerSetStyle = function(parentSelector, chartTheme)
{
var styleId = (chartTheme._datetimepickerStyleSheetId
|| (chartTheme._datetimepickerStyleSheetId = global.chartFactory.nextElementId()));
|| (chartTheme._datetimepickerStyleSheetId = chartFactory.nextElementId()));

if(global.chartFactory.isStyleSheetCreated(styleId))
if(chartFactory.isStyleSheetCreated(styleId))
return false;

var color = chartFactory.getGradualColor(chartTheme, 1);
Expand Down Expand Up @@ -812,15 +815,15 @@
+" }\n"
;

global.chartFactory.createStyleSheet(styleId, cssText);
chartFactory.createStyleSheet(styleId, cssText);

return true;
};

chartSetting.evalDataSetParamInputPayload = function(dataSetParam, defaultValue)
{
if(typeof(dataSetParam.inputPayload) == "string" && dataSetParam.inputPayload != "")
return global.chartFactory.evalSilently(dataSetParam.inputPayload, defaultValue);
return chartFactory.evalSilently(dataSetParam.inputPayload, defaultValue);
else
return (dataSetParam.inputPayload || defaultValue);
};
Expand Down Expand Up @@ -1241,16 +1244,16 @@
var styleClassName = chartTheme._chartSettingBoxStyleClassName;
if(!styleClassName)
{
styleClassName = global.chartFactory.nextElementId();
styleClassName = chartFactory.nextElementId();
chartTheme._chartSettingBoxStyleClassName = styleClassName;
}

$box.addClass(styleClassName);

var styleId = (chartTheme._chartSettingBoxStyleSheetId
|| (chartTheme._chartSettingBoxStyleSheetId = global.chartFactory.nextElementId()));
|| (chartTheme._chartSettingBoxStyleSheetId = chartFactory.nextElementId()));

if(global.chartFactory.isStyleSheetCreated(styleId))
if(chartFactory.isStyleSheetCreated(styleId))
return false;

var qualifier = "." + styleClassName;
Expand Down Expand Up @@ -1291,7 +1294,7 @@
+"} \n"
;

global.chartFactory.createStyleSheet(styleId, cssText);
chartFactory.createStyleSheet(styleId, cssText);

return true;
};
Expand Down Expand Up @@ -1676,16 +1679,16 @@
var styleClassName = chartTheme._chartSettingDataPanelStyleClassName;
if(!styleClassName)
{
styleClassName = global.chartFactory.nextElementId();
styleClassName = chartFactory.nextElementId();
chartTheme._chartSettingDataPanelStyleClassName = styleClassName;
}

$panel.addClass(styleClassName);

var styleId = (chartTheme._chartSettingDataPanelStyleSheetId
|| (chartTheme._chartSettingDataPanelStyleSheetId = global.chartFactory.nextElementId()));
|| (chartTheme._chartSettingDataPanelStyleSheetId = chartFactory.nextElementId()));

if(global.chartFactory.isStyleSheetCreated(styleId))
if(chartFactory.isStyleSheetCreated(styleId))
return false;

//表格背景色应与面板背景色一致,且不能设透明背景色,因为设置了固定列
Expand Down Expand Up @@ -1734,7 +1737,7 @@
+" background:"+chartTheme.highlightTheme.backgroundColor+";"
+" }\n";

global.chartFactory.createStyleSheet(styleId, cssText);
chartFactory.createStyleSheet(styleId, cssText);

return true;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

//@deprecated 兼容1.8.1版本的window.chartSupport变量名,未来版本会移除
global.chartSupport = chartSupport;
//@deprecated 兼容1.8.1版本的window.chartSupport变量名,未来版本会移除

//org.datagear.analysis.DataSetProperty.DataType
chartSupport.DataSetPropertyDataType =
Expand Down Expand Up @@ -3892,7 +3893,7 @@
"emphasis":
{
"shadowBlur" : 10,
"shadowColor" : global.chartFactory.getGradualColor(chartTheme, 0.9),
"shadowColor" : chartFactory.getGradualColor(chartTheme, 0.9),
}
}
}
Expand Down Expand Up @@ -4058,7 +4059,7 @@
itemStyle:
{
borderColor: chartTheme.borderColor,
shadowColor: global.chartFactory.getGradualColor(chartTheme, 0.4)
shadowColor: chartFactory.getGradualColor(chartTheme, 0.4)
}
},
label:
Expand Down Expand Up @@ -4244,7 +4245,7 @@
//偶数行样式
"odd":
{
"backgroundColor": global.chartFactory.getGradualColor(chartTheme, 0)
"backgroundColor": chartFactory.getGradualColor(chartTheme, 0)
},
//奇数行样式
"even":
Expand All @@ -4254,7 +4255,7 @@
//悬浮行样式
"hover":
{
"backgroundColor": global.chartFactory.getGradualColor(chartTheme, 0.2)
"backgroundColor": chartFactory.getGradualColor(chartTheme, 0.2)
},
//选中行样式
"selected":
Expand All @@ -4268,8 +4269,8 @@
renderValue: undefined
};

themeBindTableOptions._chartTableStyleClassName = global.chartFactory.nextElementId();
themeBindTableOptions._chartTableStyleSheetId = global.chartFactory.nextElementId();
themeBindTableOptions._chartTableStyleClassName = chartFactory.nextElementId();
themeBindTableOptions._chartTableStyleSheetId = chartFactory.nextElementId();

chartTheme._chartTableThemeBindOptions = themeBindTableOptions;
}
Expand Down Expand Up @@ -4355,8 +4356,8 @@
else
{
options.table = $.extend(true, {}, themeBindTableOptions, options.table);
options.table._chartTableStyleClassName =global.chartFactory.nextElementId();
options.table._chartTableStyleSheetId = global.chartFactory.nextElementId();
options.table._chartTableStyleClassName =chartFactory.nextElementId();
options.table._chartTableStyleSheetId = chartFactory.nextElementId();
}

//完善分页选项
Expand Down Expand Up @@ -4433,7 +4434,7 @@
chartEle.addClass("dg-hide-title");

var chartTitle = $("<div class='dg-chart-table-title' />").html(options.title.text).appendTo(chartEle);
global.chartFactory.setStyles(chartTitle, options.title);
chartFactory.setStyles(chartTitle, options.title);
var chartContent = $("<div class='dg-chart-table-content' />").appendTo(chartEle);
var table = $("<table width='100%' class='hover stripe'></table>").appendTo(chartContent);
var tableId = chart.id+"-table";
Expand Down Expand Up @@ -4628,27 +4629,27 @@
{
chart.elementJquery().addClass(styleClassName);

if(global.chartFactory.isStyleSheetCreated(styleSheetId))
if(chartFactory.isStyleSheetCreated(styleSheetId))
return false;

//样式要加".dg-chart-table-content"限定,因为图表的数据透视表功能也采用的是DataTable组件,可能会处在同一个表格图表div内
var qualifier = "." + styleClassName + " .dg-chart-table-content";

var cssText =
qualifier + " table.dataTable tbody tr{"
+ global.chartFactory.stylesObjToCssText(chartOptions.table.row)
+ chartFactory.stylesObjToCssText(chartOptions.table.row)
+" }\n"
+qualifier + " table.dataTable thead th,\n"
+qualifier + " table.dataTable thead td{"
+ global.chartFactory.stylesObjToCssText(chartOptions.table.header)
+ chartFactory.stylesObjToCssText(chartOptions.table.header)
+" }\n"
+qualifier + " table.dataTable.stripe tbody tr.odd,\n"
+qualifier + " table.dataTable.display tbody tr.odd{"
+ global.chartFactory.stylesObjToCssText(chartOptions.table.row.odd)
+ chartFactory.stylesObjToCssText(chartOptions.table.row.odd)
+" }\n"
+qualifier + " table.dataTable.stripe tbody tr.even,\n"
+qualifier + " table.dataTable.display tbody tr.even{"
+ global.chartFactory.stylesObjToCssText(chartOptions.table.row.even)
+ chartFactory.stylesObjToCssText(chartOptions.table.row.even)
+" }\n"
+qualifier + " table.dataTable.hover tbody tr.hover,\n"
+qualifier + " table.dataTable.hover tbody tr:hover,\n"
Expand All @@ -4658,7 +4659,7 @@
+qualifier + " table.dataTable.hover tbody > tr > .selected:hover,\n"
+qualifier + " table.dataTable.display tbody > tr.selected:hover,\n"
+qualifier + " table.dataTable.display tbody > tr > .selected:hover{"
+ global.chartFactory.stylesObjToCssText(chartOptions.table.row.hover)
+ chartFactory.stylesObjToCssText(chartOptions.table.row.hover)
+" }\n"
+qualifier + " table.dataTable tbody > tr.selected,\n"
+qualifier + " table.dataTable tbody > tr > .selected,\n"
Expand All @@ -4670,7 +4671,7 @@
+qualifier + " table.dataTable.stripe tbody > tr.odd > .selected,\n"
+qualifier + " table.dataTable.display tbody > tr.odd.selected,\n"
+qualifier + " table.dataTable.display tbody > tr.odd > .selected{"
+ global.chartFactory.stylesObjToCssText(chartOptions.table.row.selected)
+ chartFactory.stylesObjToCssText(chartOptions.table.row.selected)
+" }\n"
+qualifier + " table.dataTable thead th.sorting div.DataTables_sort_wrapper span{"
+ " background:" + chartOptions.table.header.color+";"
Expand All @@ -4684,7 +4685,7 @@
+ " background: none;"
+" }\n";

global.chartFactory.createStyleSheet(styleSheetId, cssText);
chartFactory.createStyleSheet(styleSheetId, cssText);

return true;
};
Expand Down Expand Up @@ -5058,24 +5059,24 @@
if(valueFirst)
{
$labelValue = $("<div class='label-value'></div>").appendTo($label);
global.chartFactory.setStyles($labelValue, renderOptions.label.value);
chartFactory.setStyles($labelValue, renderOptions.label.value);

if(showName)
{
$labelName = $("<div class='label-name'></div>").appendTo($label);
global.chartFactory.setStyles($labelName, renderOptions.label.name);
chartFactory.setStyles($labelName, renderOptions.label.name);
}
}
else
{
if(showName)
{
$labelName = $("<div class='label-name'></div>").appendTo($label);
global.chartFactory.setStyles($labelName, renderOptions.label.name);
chartFactory.setStyles($labelName, renderOptions.label.name);
}

$labelValue = $("<div class='label-value'></div>").appendTo($label);
global.chartFactory.setStyles($labelValue, renderOptions.label.value);
chartFactory.setStyles($labelValue, renderOptions.label.value);
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
var dashboardBase = (dashboardFactory.dashboardBase || (dashboardFactory.dashboardBase = {}));

//----------------------------------------
// chartStatusConst扩展开始
// chartStatusConst开始
//----------------------------------------

/**图表状态:需要参数值*/
Expand All @@ -63,7 +63,7 @@
chartStatusConst.UPDATE_ERROR = "UPDATE_ERROR";

//----------------------------------------
// chartStatusConst扩展结束
// chartStatusConst结束
//----------------------------------------

//----------------------------------------
Expand Down Expand Up @@ -202,11 +202,11 @@
*/
dashboardFactory._initChartMapURLs = function()
{
for(var i=0; i<this.builtInEchartsMaps.length; i++)
for(var i=0; i<this.builtinChartMaps.length; i++)
{
var urlNames = this.builtInEchartsMaps[i];
var urlNames = this.builtinChartMaps[i];
for(var j=0; j<urlNames.names.length; j++)
chartFactory.chartMapURLs[urlNames.names[j]] = this.builtInEchartsMapBaseURL + urlNames.url;
chartFactory.chartMapURLs[urlNames.names[j]] = this.builtinChartMapBaseURL + urlNames.url;
}

var mapUrls = $(document.body).attr(elementAttrConst.MAP_URLS);
Expand Down Expand Up @@ -1641,8 +1641,8 @@
/**
* 内置地图JSON地址配置。
*/
dashboardFactory.builtInEchartsMapBaseURL = "/static/lib/echarts-map";
dashboardFactory.builtInEchartsMaps =
dashboardFactory.builtinChartMapBaseURL = "/static/lib/echarts-map";
dashboardFactory.builtinChartMaps =
[
{names: ["china", "中国"], url: "/china.json"},
{names: ["china-contour", "中国轮廓"], url: "/china-contour.json"},
Expand Down

0 comments on commit eb1b169

Please sign in to comment.