问题
i have two same graph.i want to remove the label from the second one as it is not required. below is the code for input:
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"
}];
in scree shot there are 3 labels. i do not want label in second graph. there is any specific property for that?
回答1:
Add this to the options for the second chart:
legend: {
show: false
},
See this updated fiddle.
回答2:
Make sure you don't have the label property when you init the second graph
$.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 }
},...
来源:https://stackoverflow.com/questions/27014954/remove-labels-in-flot