Cleanup and improve charts.

This commit is contained in:
James Cole
2014-09-11 21:58:08 +02:00
parent 2a54b36db0
commit 9bcd27b847
2 changed files with 18 additions and 38 deletions

View File

@@ -10,7 +10,5 @@
// //
// The available directives right now are require, require_directory, and require_tree // The available directives right now are require, require_directory, and require_tree
// //
//= require highslide/highslide-full.min
//= require highslide/highslide.config
//= require_tree highcharts //= require_tree highcharts
//= require firefly/accounts //= require firefly/accounts

View File

@@ -12,42 +12,35 @@ if($('#chart').length == 1) {
series: data.series, series: data.series,
title: { title: {
text: data.chart_title text: null
}, },
yAxis: { yAxis: {
formatter: function () { allowDecimals: false,
return '$' + Highcharts.numberFormat(this.y, 0); labels: {
} formatter: function () {
}, if(this.value >= 1000 || this.value <= -1000) {
subtitle: { return '\u20AC ' + (this.value / 1000) + 'k';
text: data.subtitle, }
useHTML: true return '\u20AC ' + this.value;
},
}
},
title: {text: null}
},
xAxis: { xAxis: {
floor: 0,
type: 'datetime', type: 'datetime',
dateTimeLabelFormats: { dateTimeLabelFormats: {
day: '%e %b', day: '%e %b',
year: '%b' week: '%e %b'
}, },
title: { title: {
text: 'Date' text: null
} }
}, },
legend: {enabled:false},
tooltip: { tooltip: {
shared: true,
crosshairs: false,
formatter: function () { formatter: function () {
var str = '<span style="font-size:80%;">' + Highcharts.dateFormat("%A, %e %B", this.x) + '</span><br />'; return this.series.name + ': \u20AC ' + Highcharts.numberFormat(this.y,2);
for (x in this.points) {
var point = this.points[x];
var colour = point.point.pointAttr[''].fill;
str += '<span style="color:' + colour + '">' + point.series.name + '</span>: \u20AC ' + Highcharts.numberFormat(point.y, 2) + '<br />';
}
//console.log();
return str;
return '<span style="font-size:80%;">' + this.series.name + ' on ' + Highcharts.dateFormat("%e %B", this.x) + ':</span><br /> \u20AC ' + Highcharts.numberFormat(this.y, 2);
} }
}, },
plotOptions: { plotOptions: {
@@ -60,23 +53,12 @@ if($('#chart').length == 1) {
threshold: 0, threshold: 0,
lineWidth: 1, lineWidth: 1,
marker: { marker: {
radius: 2 radius: 0
}, },
point: { point: {
events: { events: {
click: function (e) { click: function (e) {
hs.htmlExpand(null, { alert('click!');
src: 'chart/home/info/' + this.series.name + '/' + Highcharts.dateFormat("%d/%m/%Y", this.x),
pageOrigin: {
x: e.pageX,
y: e.pageY
},
objectType: 'ajax',
headingText: '<a href="#">' + this.series.name + '</a>',
width: 250
}
)
;
} }
} }
} }