Hey guys I was wondering if you could help me get this code working to display the label field instead of the first data set. I also need help getting the label to be added into the loop generating the points.
Here is the full code and some more information about it in the comments: http://pastebin.com/fNfgKijp
Specifics (for loop adding points):
$(function () {
var d1 = [];
var d2 = { label: 'Target',
color: 'blue',
points: {radius: 8},
data: [[mileMedian, priceMedian]]
};
var d3 = {label: yourCar[0][0],
color: 'green',
points: {radius: 8},
data: [[yourCarMiles,yourCarPrice]]
};
for (i = 0; i <= totalCars - 1; i++){
d1.push([allCars[i][1], allCars[i][2]]);
// not sure what syntax to use to get this to add a label to the d1 data set.
}
var options = {
series: {color: '#bbb'},
lines: {show: false},
points: {show: true, radius: 4},
xaxis: {label: 'Miles', min: startMileRange, max: mileRangeEnd},
yaxis: {label: 'Price', min: startPriceRange, max: priceRangeEnd},
grid: {markings: [{xaxis: {from: mileMedian, to: mileMedian}, color: 'black'}, {yaxis: {from: priceMedian, to: priceMedian}, color: 'black'}]}
}
$.plot($("#placeholder"), [d1, d2, d3 ], options);
});