- new Dygraph(document.getElementById("div_g"),
- data,
- {
- legend: "always",
- //title:"line name",// 图表的名字
- titleHeight : 25,// 定义图表名字文字的高度
- labels: ['Date','Value'],// 指定 x 轴和 y 轴的含义
- highlightCircleSize : 5,// 指定鼠标放到具体的顶点时, 顶点的动态表现形式
- strokeWidth : 2,// 定义线条的粗细
- maxNumberWidth : 30,// 指定数字最大宽度
- // colors : echartLineColor,// 多条曲线时为数组, 每条线的颜色
- connectSeparatedPoints : true,// 如果两点不是连续的此属性为 true 时, 会强制连接两点
- includeZero : true,//y 轴是否显示 0 点
- highlightSeriesOpts :
- {
- strokeWidth : 2,
- strokeBorderWidth : 1,
- highlightCircleSize : 5
- },
- legendFormatter : function(data)
- {
- var returnString = "";
- var dataList = data.series;
- var dateString = "";
- for (var index = 0; index <dataList.length; index++)
- {
- var dataObj = dataList[index];
- if (dataObj.isHighlighted)
- {
- if (window.event)
- {
- var width = parseFloat("600px");
- var height = parseFloat("300px");
- $("#div_g .dygraph-legend").CSS({
- "position": "absolute",
- "background":"#c3c7cc",
- "opacity":"0.5",
- "color":"red",
- "top":window.event.offsetY> height ? (window.event.offsetY + "px")
- : (window.event.offsetY + 20 + "px"),
- "left":window.event.offsetX> width/2 ? (window.event.offsetX + "px")
- : (window.event.offsetX + "px")});
- dateString = data.xhtml;
来源: http://www.bubuko.com/infodetail-2737220.html