跳到主要内容

LineTimeLineHelper

LineTimeLineHelper

目前的standard-chart为单次渲染模式,两次渲染间的状态不能做记录,所以框架为折线与时间轴的联动做了一个辅助类LineTimeLineHelper

lineTimeLineHelper初始化

lineTimeLineHelper初始化需要在生命周期 dv:afterupdate 的钩子函数中实现

chart.on('dv:afterupdate', () => {
// 以下为lineTimeLineHelper的默认实例化配置
const lineTimeLineHelper = new StandardChart.LineTimeLineHelper(chart: StandardChart, config: TimeLineHelperCfg);
})

(percent: number,lineClipPath: Element,lineModelAndView: ModelAndView,lineModelsAndViews: ModelAndView[],breathCircle?:BreathCircle,verticalPointer?: Line) => void;

初始化参数

参数配置类型默认值描述备注
chartStandardChart动态折线图的实例对象
configobjectLineTimeLineHelper的初始化设置
config.durationnumber250时间点变化时,折线图像的动画时间
config.during(percent: number,lineClipPath: Element,lineModelAndView: ModelAndView,lineModelsAndViews: ModelAndView[],breathCircle?:BreathCircle,verticalPointer?: Line) => void;undefined折线从一个节点变化到另一个节点的动画的帧回调,percent表示动画时间的进度
config.delaynumber0时间点变化时,折线图像动画的延迟时间
config.easingstring'linear'时间点变化时,动画的缓动函数
config.done(percent: number) => void() => {}时间点变化时,动画完成的回调函数,percent为当前动画的百分比进度
config.breathPointobject折线呼吸点的样式配置
config.breathPoint.showbooleantrue是否显示呼吸点
config.breathPoint.shape.rnumber3呼吸点的半径
config.breathPoint.styleobject呼吸点的样式
config.breathPoint.style.fillstring'inherit'呼吸点的填充颜色默认值‘inherit’表示呼吸点填充色为对应折线的颜色。颜色可为渐变色
config.breathPoint.style.strokestring呼吸点描边颜色同fill
config.breathPoint.style.其他其余样式后续待添加 或vanish联系钱晓东(qianxiaodong@myhexin.com
config.verticalPointerobject折线竖线标签的样式配置
config.verticalPointer.showbooleantrue是否显示竖线标签
config.verticalPointer.styleobject竖线标签的样式
config.verticalPointer.style.lineDashfalse | number[] | 'solid' | 'dashed' | 'dotted'[2, 2]设置竖线的虚线样式(1)数组中元素个数是奇数的话,数组会默认把组内元素复制一份。
(2)数组中下标是奇数的元素是虚线小段的尺寸,下标是偶数的元素则是虚线小段之间的间距
下边举例说明:
“lineDash:[6]” === “lineDash:[6,6]” //释义第一个"6"是虚线小段的长度,第二个"6"是虚线的间隔
“lineDash:[1,2,3,4]” // 释义 "1"是第一段虚线长度,"2"紧跟着的间隔,"3"是第二段虚线的长度,"4"是第二段虚线后边的间隔
config.verticalPointer.style.其他其余样式后续待添加 或vanish联系钱晓东(qianxiaodong@myhexin.com
config.endLabelobject动态折线的末尾标签的配置对象
config.endLabel.containLabelbooleantrue末尾标签动画是否局限在图表内部

lineTimeLineHelper.start()

// 初始化折线图像到x轴的第一个点

lineTimeLineHelper.change(index: number, noAnimation = false)

//  将折线图图像动画到x轴的index点位置, noAinmation默认本次转移为带有动画