删除flot中的标签

时间:2014-11-19 10:49:50

标签: jquery flot

enter image description here我有两个相同的图。我想从第二个删除标签,因为它不是必需的。 下面是输入代码:

var d =
                 [
                     {
                         "label": "ABSOLUTE RETURN", "data": [[18, 40], [19, 20], [20, 100], [21, 100], [22, 100],
                           [23, 100], [24, 100], [25, 100], [26, 100], [27, 100], [28, 100], [29, 100], [30, 100],
                           [31, 50], [32, 40], [33, 60], [34, 70], [35, 40], [36, 100], [37, 100], [38, 100],
                           [39, 100], [40, 100], [41, 100], [42, 100], [43, 100], [44, 100], [45, 100], [46, 100], [47, 100]], "color": "#395A85"
                     }, {
                         "label": "EMERGING MARKETS EQUITY (MGI)", "data": [[18, 30], [19, 20], [20, 0], [21, 0],
                             [22, 0], [23, 0], [24, 0], [25, 0], [26, 0], [27, 0], [28, 0], [29, 0],
                             [30, 0], [31, 50], [32, 20], [33, 0], [34, 0], [35, 0], [36, 0], [37, 0],
                             [38, 0], [39, 0], [40, 0], [41, 0], [42, 0], [43, 0], [44, 0], [45, 0],
                             [46, 0], [47, 0]], "color": "#6EAA38"
                     }, {
                         "label": "ACTIVE GLOBAL EQUITY (MGI) HEDGED VERSION", "data": [[18, 30], [19, 80], [20, 0], [21, 0], [22, 0],
                             [23, 0], [24, 0], [25, 0], [26, 0], [27, 0], [28, 0], [29, 0], [30, 0], [31, 0], [32, 20], [33, 20], [34, 40],
                             [35, 0], [36, 0], [37, 0], [38, 0], [39, 0], [40, 0], [41, 0], [42, 0], [43, 0], [44, 0], [45, 0], [46, 0], [47, 0]], "color": "#00A8C8"
                     }];
在scree拍摄中有3个标签。我不想在第二张图中标注。那有什么具体的属性吗?

2 个答案:

答案 0 :(得分:1)

将其添加到第二个图表的选项中:

    legend: {
        show: false   
    },

请参阅此更新fiddle

答案 1 :(得分:0)

确保在初始化第二个图表时没有label属性

$.plot("#graph1", [ { label: "sin(x)", data: d1 }, { label: "cos(x)", data: d2 }, { label: "tan(x)", data: d3 } ], { series: { lines: { show: true }, points: { show: true } }, ...

$.plot("#graph2", [ { series: { lines: { show: true }, points: { show: true } },...