【发布时间】:2015-02-03 20:21:05
【问题描述】:
在我的flot图表中,当数据太大时,图例不适合图表视图,所以我决定让图例出现在外部容器中,但看起来flot在1行中创建了一个表td元素,图例是不包裹在 div 内。不知何故,我的堆叠似乎效果不佳,是否存在数据问题?
数据格式
[{
"data": [
[1415059200000, 2],
[1415145600000, 2],
[1415318400000, 1],
[1415577600000, 1],
[1415750400000, 1],
[1415923200000, 3],
[1416009600000, 1],
[1416096000000, 1],
[1416182400000, 1],
[1416873600000, 2],
[1416960000000, 2],
[1418342400000, 2]
],
"label": "Neeraj_secure",
"bars": {
"show": "true",
"barWidth": 36000000,
"fillColor": "#46CEAD",
"order": 1,
"align": "center"
},
"stack": true
}]
html 容器
<div id="adoptionLegendContainer"></div>
<flot dataset="tasksRunData" options="tasksRunChartOptions" class="center-block" width="100%" height="400px" min="reportTasksRunRange.min" max="reportTasksRunRange.max"></flot>
图表选项
xaxis: {
mode: "time",
timeformat: "%m/%d/%y",
minTickSize: [1, "day"]
},
grid: {
labelMargin: 10,
hoverable: true,
borderWidth: 0
},
series: {
stack: true
},
colors: colorCodes,
tooltip: true,
legend: {
show: true,
noColumns: 0, // number of colums in legend table
labelFormatter: null, // fn: string -> string
labelBoxBorderColor: "#888", // border color for the little label boxes
container: "#adoptionLegendContainer", // container (as jQuery object) to put legend in, null means default on top of graph
position: "nw", // position of default legend container within plot
margin: [5, 10], // distance from grid edge to default legend container within plot
backgroundOpacity: 0 // set to 0 to avoid background
}
请帮忙。我提供plunker link here
【问题讨论】:
标签: javascript angularjs flot