gRaphael折线图:用JSON数据填充弹出标签而不是x&y坐标

gRaphael Line Chart: JSON Data to Populate Popup Tags Instead of x & y Coordinates?

本文关键字:amp 坐标 标签 折线图 JSON 数据 填充 gRaphael      更新时间:2023-09-26

var times=[["1:30pm","2:30pm"],["3:30pm","5:30am"],【"12:30pm"、"2:30ppm"】,【"9:30am"、"2:00pm"、"4:30pm"】、【"3:30pm"、"5:30pm"】、["10:30am","12:30pm"],[];我有一个拉斐尔折线图,基于其中一个滚动弹出标签的例子。当前,标记由Y轴的数据填充。X=一周中的某一天,Y="安全分数",JSON数据是每天报告的事件次数。

我似乎找不到任何关于如何调用第三个数据集来填充标记的文档,而且我似乎无法在不破坏代码的情况下使用代码。有什么建议吗?

这是我的标签代码:

//tags
for (var i = 0, ii = this.y.length; i < ii; i++) {
    this.tags.push(r.tag(this.x, this.y[i], this.values[i], 90, 0).insertBefore(this).attr([{ fill: "#fff"}, { fill: this.symbols[i].attr("fill") }]));
                    }
                }, function () {
    this.tags && this.tags.remove();
    //end tags
});

这是我的数据:

var times = [["1:30pm", "2:30pm"],  ["3:30pm", "5:30am"], ["12:30pm", "2:30pm"], ["9:30am", "2:30pm", "4:30pm"], ["3:30pm", "5:30pm"], ["10:30am", "12:30pm"], [] ]; 

好吧,我想通了!给你。

var times = [["1:30pm", "2:30pm"],  ["3:30pm", "5:30am"], ["12:30pm", "2:30pm"], ["9:30am", "2:30pm", "4:30pm"], ["3:30pm", "5:30pm"], ["10:30am", "12:30pm"], [] ]; 


    //tags
    for (var i = 0, ii = this.y.length; i < ii; i++) {
                            this.tags.push(r.tag(this.x, this.y[i]-10, times[i].join("'n"), 90, 0).insertBefore(this).attr([{ fill: "#fff"}, { fill: this.symbols[i].attr("fill") }]));
                        }
                    }, function () {
                        this.tags && this.tags.remove();
    //end tags
});