So I tried to attach axislabels to my graph by using the plugin from https://github.com/markrcote/flot-axislabels
$.ajax({
type: "POST",
url: "includes/getjson.php",
data: $('.ids:checked').serialize(),
dataType: "json",
success: function(datasets){
$.each(datasets, function(index,value) {
var element = "<div class='flot-chart'><div class='flot-chart-content' id='placeholder_"+index+"'></div></div>";
$('#graphbody').append(element);
var options = {
series: {
lines: { show: true },
points: { show: true }
},
xaxis: {
mode: "time",
timeformat: "%H:%M:%S",
twelveHourClock: false,
timezone: "browser",
axisLabel: 'X',
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',
axisLabelPadding: 5
},
yaxis: {
axisLabel: 'Sin(X)',
axisLabelUseCanvas: true,
axisLabelFontSizePixels: 12,
axisLabelFontFamily: 'Verdana, Arial, Helvetica, Tahoma, sans-serif',
axisLabelPadding: 5
},
grid: {
hoverable: true,
clickable: true
}
};
//plotting the rececived data
$.plot('#placeholder_'+index, [value['raw']],options);
I tried on a basic graph directly from the flot-site and it worked, but I can't seem to find the missing part that causing the labels not working.
I've included the following:
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="js/plugins/flot/jquery.flot.js"></script>
<script language="javascript" type="text/javascript" src="js/plugins/flot/jquery.flot.axislabels.js"></script>