Looking through the code in cheetahgenerator.py it seems that a fix could be achieved by adding a test to see if the year already exists in 'SummaryByYear' before appending the year. However, I am only an enthusiastic dabbler when it comes to all this stuff and have only got this far by a lot of 'trial and error' and I do not have a clue as to how to write the code which needs to inserted into the cheetahgenerator.py file to perform this test.
As a result of calling the 6 different templates a year appears 6 times in the list of years!
Matthew
Thank you for your help. Code modified and after a restart all working correctly. Just need to remember that I made this change when it comes time to upgrade. :-)
Now that I have over a year's worth of data generated by the combination of a Davis Vantage PRO2 weather station and WeeWX software running on a Raspberry Pi I would like to present comparatives between the current and previous year's statistical data in a more visual way. To do this I have decided to use the Highcharts charting library.
My work flow involves pre-processing the data needed for a chart by specifying a template file in the 'SummaryByYear' section of skin.conf to create a file containing an array of the required data.
<script src="js/jquery-1.8.2.min.js"></script>
<script src="js/highcharts.js"></script>
<script src="js/highcharts-more.js"></script>
<script src="js/themes/grid.js"></script>
<script>
$(document).ready(function() {
var options = {
chart: {
renderTo: 'Chart1',
type: 'boxplot'
},
title: {
text: '2013/14 Monthly Temperature Statistics'
},
subtitle: {
text: '(Max, Avg Max, Mean, Avg Min, Min)'
},
legend: {
enabled: true
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec']
},
yAxis: {
minorTickInterval: 'auto',
minorTickLength: 0,
title: {
text: 'Degrees C'
}
},
plotOptions: {
boxplot: {
fillColor: 'LightSteelBlue',
groupPadding: 0.2,
lineWidth: 3,
medianWidth: 3,
stemWidth: 3,
whiskerLength: '75%',
whiskerWidth: 3
}
},
tooltip: {
enabled: false
},
series: [{
name: '2013',
pointPadding: 0.25
}, {
name: '2014',
pointPadding: 0.25
}]
};
$.getJSON('Data/Data-2013.json', function(data) {
options.series[0].data = data;
$.getJSON('Data/Data-2014.json', function(data) {
options.series[1].data = data;
var chart = new Highcharts.Chart(options);
});
});
});
</script>