Ich habe einige Daten von der Db, die ich in einer Grafik zeigen möchte. Dies sind Daten Beispiel - Datum und eine bestimmte AnzahlZeige Datum von DB in jQuery Flot
[[2016-03-10, 4], [2016-03-11, 3], [2016-03-12, 6]]
Daten in JS aus Zweig Variable genommen wird
var searchFlot = '{{ flotSearch|raw }}';
var barOptions = {
series: {
lines: {
show: true,
lineWidth: 2,
fill: true,
fillColor: {
colors: [{
opacity: 0.0
}, {
opacity: 0.0
}]
}
}
},
xaxis: {
mode: "time",
timeformat: "%Y-%m-%d",
minTickSize: [1, "day"]
},
colors: ["#1ab394"],
grid: {
color: "#999999",
hoverable: true,
clickable: true,
tickColor: "#D4D4D4",
borderWidth:0
},
legend: {
show: false
},
tooltip: true,
tooltipOpts: {
content: "x: %x, y: %y"
}
};
$('document').ready(function() {
$.plot($("#flot-search"), [{label: "Searches", data: searchFlot}], barOptions);
});
Es Graph Gitter zeigt, aber keine Daten auf dem Diagramm dargestellt. X-Achse zeigt nur 1970-01-01 Label.
Kurze Erklärung: '2016-03-10' ist das gleiche wie' 2003' und ist ein Zeitstempel etwa 2 Sekunden nach Mitternacht am 1970-01-01. – Raidri