2021SC@SDUSC
AxisPointer.js
AxisPointer为echarts中的坐标指示器,包括直角坐标以及极坐标等。
axisPointer.js文件中注册了axisPointer对外api,主要代码如下:
echarts.registerAction({
type: 'updateAxisPointer',
event: 'updateAxisPointer',
update: ':updateAxisPointer'
}, axisTrigger);
存储coordSysAxesInfo信息,主要代码如下:
echarts.registerProcessor(echarts.PRIORITY.PROCESSOR.STATISTIC, function (ecModel, api)
{
ecModel.getComponent('axisPointer').coordSysAxesInfo
= axisPointerModelHelper.collect(ecModel, api);
});
AxisPointerModel
AxisPointerModel通过extendComponentModel方法扩展自Component Model,重写了defaultOption属性。
AxisPointerView
AxisPointerView过extendComponentModel方法扩展自Component View,重写了render、remove以及dispose方法。
BaseAxisPointer
BaseAxisPointer为CartesianAxisPointer、PolarAxisPointer等的基类,重写了render以及renderHandler等方法。renderHandler主要是定义move、drag等情况时视图更新方法。
主要代码:
render: function (axisModel, axisPointerModel, api, forceRender) {
...
var elOption = {};
// 调用子类的makeElOption方法
this.makeElOption(elOption, value, axisModel, axisPointerModel, api);
...
// 创建pointer
this.createPointerEl(group, elOption, axisModel, axisPointerModel);
// 渲染label元素
this.createLabelEl(group, elOption, axisModel, axisPointerModel);
...
updat