small refactoring in history_chart.js