I am plotting a dynamic barchart using flot. I have managed to plot with constant barwidth. Now I want the barwidth to vary based on the output of my analysis. I set
var options = { series: {
bars:{show:true,
barWidth: BarWidth,
fillColor: "lightgreen",
fill: true
}
In this code, BarWidth
is a javascript variable. My bar starts to plot and gets overlapped when my BarWidth changes.
Does anyone has any clue how I can solve my problem?
Thank you in advance!
@DNS This is my plot function
function plot_status(statusData, no_strips)
{
new_data = new_data.concat([statusData]);
var options = {
series: {
bars:{show:true,
barWidth: no_strips*72,
fillColor: "lightgreen",
fill: true
}
},
grid: {clickable: true, hoverable: true, borderWidth: 1 }
};
$(document).ready(function() {
chart1 = $.plot($("#placeholder"),
[{
data: new_data,
threshold: {
below: 0,
color: "red"
},
color: "black",
xaxis: {ticks:8,minTickSize: 1},
yaxis: {min:-1,max:3,tickSize:1},
grid: { borderWidth: 1 }
}],options)
});
Every four seconds, statusData
and no_strips
change. new_data contains a series of data that is plotted. The barchar grows with time as long as statusData is concatenated to new_data. no_strips
determine the barWidth of each plot of the barchart. I will also include sample of barchart I would like to produce.
With a constant barWidth
this is what I produce
This is my data: [[0, 1], [1200, 1], [2400, -1], [3600, 1], ... ]; rather I was sending it
for my above plot.
This is the the data I want to plot [[0, 1], [72, 1], [144, -1], [432, 1],[504,1],...]every
[a,b]` is added every four seconds.