I am new to using Highcharts, so this may be a trivial issue. However, I have not had much success through my own googling about this.
I am trying to get a line graph to display strength progress over time, but every time I plug in the keySet() (of type java.util.Date) to be what is on the X-axis, the graph disappears from the web page.
I want the record of an event being done and the date it was done on to be a point on the graph (i.e. the (x,y) would be (action, date)).
Java stuff:
List<StrengthProgressPoint> records = getAllStrengthLogsForExercise(session, exerciseName);
Map<Date, Double> strengthGraph = new LinkedHashMap<>();
for(StrengthProgressPoint p : records) {
strengthGraph.put(p.getDate(), p.getWeight());
}
Highcharts stuff:
<script>
$(function () {
$('#progressGraphContainer').highcharts({
title: {
text: ''
},
subtitle: {
text: ''
},
yAxis: {
min: 0,
title: {
text: 'Weight Lifted'
}
},
xAxis: {
categories: [[${strengthGraph.keySet()}]],
},
legend: {
enabled: false
},
plotOptions: {
series: {
label: {
connectorAllowed: false,
connectNulls: true
},
}
},
series: [{
name: 'Weight',
data: [[${strengthGraph.values()}]]
}],
responsive: {
rules: [{
condition: {
maxWidth: 500
},
chartOptions: {
legend: {
enabled: false
}
}
}]
}
});
});
</script>
I did get a graph to display on my web page a few times, but never what I wanted. I have seemingly narrowed it down to the 'categories: [[${strengthGraph.keySet()}]]' being the culprit of causing the graph to just not show up on the web page. I just want the dates in the HashMap to display on the x-axis (and correspond to the appropriate values of course).