forked from p85126437/datagear
看板JS对象新增mapURLs函数,为自定义地图URL映射提供API;
This commit is contained in:
parent
9a79da1885
commit
90d7ab7db1
|
@ -504,6 +504,7 @@ DataGear版本更新日志
|
|||
新增:图表JS对象新增resultData函数,用于获取/设置图表数据集结果数据;
|
||||
新增:图表JS对象新增resultDataElement函数,用于获取图表数据集结果数据指定索引的元素;
|
||||
新增:图表JS对象新增gradualColor函数,用于为图表配色提供支持;
|
||||
新增:看板JS对象新增mapURLs函数,为自定义地图URL映射提供API;
|
||||
修复:修复参数化数据集对于大数值参数可能出现精度丢失的BUG;
|
||||
修复:修复数据管理列表/编辑页面、SQL工作台查询结果对于大数值会出现精度丢失的BUG;
|
||||
修复:修复在已登录状态下打开/login地址会死循环的BUG;
|
||||
|
|
|
@ -161,7 +161,6 @@
|
|||
chartFactory.initRenderContext(dashboard.renderContext);
|
||||
|
||||
this._initOverwriteChartBase();
|
||||
this._initChartMapURLs();
|
||||
$.extend(dashboard, this.dashboardBase);
|
||||
dashboard.init();
|
||||
|
||||
|
@ -198,27 +197,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化chartFactory.chartMapURLs。
|
||||
* 它将body元素的elementAttrConst.MAP_URLS属性值设置为自定义地图JSON地址映射表。
|
||||
*/
|
||||
dashboardFactory._initChartMapURLs = function()
|
||||
{
|
||||
for(var i=0; i<this.builtinChartMaps.length; i++)
|
||||
{
|
||||
var urlNames = this.builtinChartMaps[i];
|
||||
for(var j=0; j<urlNames.names.length; j++)
|
||||
chartFactory.chartMapURLs[urlNames.names[j]] = this.builtinChartMapBaseURL + urlNames.url;
|
||||
}
|
||||
|
||||
var mapUrls = $(document.body).attr(elementAttrConst.MAP_URLS);
|
||||
|
||||
if(mapUrls)
|
||||
mapUrls = chartFactory.evalSilently(mapUrls);
|
||||
|
||||
$.extend(chartFactory.chartMapURLs, mapUrls);
|
||||
};
|
||||
|
||||
/**
|
||||
* 开始执行心跳请求。
|
||||
* @param heartbeatURL 心跳URL,可选,初次调用时需设置
|
||||
|
@ -655,11 +633,38 @@
|
|||
this.charts = (this.charts || []);
|
||||
|
||||
this._initListener();
|
||||
this._initMapURLs();
|
||||
this._initForms();
|
||||
this._initChartResizeHandler();
|
||||
this._initCharts();
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化地图URL映射表。
|
||||
* 它将body元素的elementAttrConst.MAP_URLS属性值设置为地图URL映射表。
|
||||
*/
|
||||
dashboardBase._initMapURLs = function()
|
||||
{
|
||||
var builtinChartMaps = dashboardFactory.builtinChartMaps;
|
||||
var builtinChartMapBaseURL = dashboardFactory.builtinChartMapBaseURL;
|
||||
|
||||
var mapURLs = {};
|
||||
|
||||
for(var i=0; i<builtinChartMaps.length; i++)
|
||||
{
|
||||
var urlNames = builtinChartMaps[i];
|
||||
for(var j=0; j<urlNames.names.length; j++)
|
||||
mapURLs[urlNames.names[j]] = builtinChartMapBaseURL + urlNames.url;
|
||||
}
|
||||
|
||||
var mapURLsBody = $(document.body).attr(elementAttrConst.MAP_URLS);
|
||||
|
||||
if(mapURLsBody)
|
||||
mapURLs = $.extend(mapURLs, chartFactory.evalSilently(mapURLsBody, {}));
|
||||
|
||||
this.mapURLs(mapURLs);
|
||||
};
|
||||
|
||||
/**
|
||||
* 初始化看板的监听器。
|
||||
* 它将body元素的elementAttrConst.DASHBOARD_LISTENER属性值设置为看板的监听器。
|
||||
|
@ -828,6 +833,23 @@
|
|||
chartListener.updateError = undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取/设置地图URL映射表。
|
||||
*
|
||||
* @param mapURLs 可选,要设置的地图URL映射表,仅会覆盖同名的地图URL映射,格式为参考chartFactory.chartMapURLs说明
|
||||
* @returns 要获取的地图URL映射表
|
||||
*/
|
||||
dashboardBase.mapURLs = function(mapURLs)
|
||||
{
|
||||
if(!chartFactory.chartMapURLs)
|
||||
chartFactory.chartMapURLs = {};
|
||||
|
||||
if(mapURLs === undefined)
|
||||
return chartFactory.chartMapURLs;
|
||||
|
||||
$.extend(chartFactory.chartMapURLs, mapURLs);
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取看板的代理图表监听器。
|
||||
* 为了确保任意时刻设置看板监听器(dashboard.listener(...))都能传递至图表,所以此方法应始终返回不为null且引用不变的对象。
|
||||
|
|
|
@ -587,6 +587,7 @@ readonly 是否只读操作,允许为null
|
|||
{name: "dashboard.loadChart", value: "loadChart(", caption: "loadChart()", meta: " dashboard"},
|
||||
{name: "dashboard.loadCharts", value: "loadCharts(", caption: "loadCharts()", meta: " dashboard"},
|
||||
{name: "dashboard.loadUnsolvedCharts", value: "loadUnsolvedCharts()", caption: "loadUnsolvedCharts()", meta: " dashboard"},
|
||||
{name: "dashboard.mapURLs", value: "mapURLs(", caption: "mapURLs()", meta: " dashboard"},
|
||||
{name: "dashboard.originalInfo", value: "originalInfo(", caption: "originalInfo()", meta: " dashboard"},
|
||||
{name: "dashboard.refreshData", value: "refreshData(", caption: "refreshData()", meta: " dashboard"},
|
||||
{name: "dashboard.removeChart", value: "removeChart(", caption: "removeChart()", meta: " dashboard"},
|
||||
|
|
Loading…
Reference in New Issue