Various chart cleanups.

This commit is contained in:
James Cole
2014-09-11 10:09:09 +02:00
parent ab9e5f716d
commit fa665de847
6 changed files with 42 additions and 76 deletions

View File

@@ -43,11 +43,11 @@ if($('#chart').length == 1) {
for (x in this.points) { for (x in this.points) {
var point = this.points[x]; var point = this.points[x];
var colour = point.point.pointAttr[''].fill; var colour = point.point.pointAttr[''].fill;
str += '<span style="color:' + colour + '">' + point.series.name + '</span>: ' + Highcharts.numberFormat(point.y, 2) + '<br />'; str += '<span style="color:' + colour + '">' + point.series.name + '</span>: \u20AC ' + Highcharts.numberFormat(point.y, 2) + '<br />';
} }
//console.log(); //console.log();
return str; return str;
return '<span style="font-size:80%;">' + this.series.name + ' on ' + Highcharts.dateFormat("%e %B", this.x) + ':</span><br /> ' + Highcharts.numberFormat(this.y, 2); 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: {

View File

@@ -38,11 +38,11 @@ if($('#chart').length == 1) {
for (x in this.points) { for (x in this.points) {
var point = this.points[x]; var point = this.points[x];
var colour = point.point.pointAttr[''].fill; var colour = point.point.pointAttr[''].fill;
str += '<span style="color:' + colour + '">' + point.series.name + '</span>: ' + Highcharts.numberFormat(point.y, 2) + '<br />'; str += '<span style="color:' + colour + '">' + point.series.name + '</span>: \u20AC ' + Highcharts.numberFormat(point.y, 2) + '<br />';
} }
//console.log(); //console.log();
return str; return str;
return '<span style="font-size:80%;">' + this.series.name + ' on ' + Highcharts.dateFormat("%e %B", this.x) + ':</span><br /> ' + Highcharts.numberFormat(this.y, 2); 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: {

View File

@@ -1,6 +1,4 @@
$(function () { $(function () {
/** /**
* get data from controller for home charts: * get data from controller for home charts:
*/ */
@@ -17,20 +15,22 @@ $(function () {
}, },
yAxis: { yAxis: {
allowDecimals: false, allowDecimals: false,
alternateGridColor: true,
labels: { labels: {
formatter: function () { formatter: function () {
return '€ ' + this.value; if(this.value >= 1000 || this.value <= -1000) {
return '\u20AC ' + (this.value / 1000) + 'k';
}
return '\u20AC ' + this.value;
} }
}, },
title: {text: null} 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: null text: null
@@ -38,9 +38,6 @@ $(function () {
}, },
legend: {enabled:false}, legend: {enabled:false},
tooltip: { tooltip: {
shared: false,
crosshairs: false,
formatter: function () { formatter: function () {
return this.series.name + ': \u20AC ' + Highcharts.numberFormat(this.y,2); return this.series.name + ': \u20AC ' + Highcharts.numberFormat(this.y,2);
} }
@@ -55,23 +52,12 @@ $(function () {
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="accounts/show/' + this.series.id + '">' + this.series.name + '</a>',
width: 250
}
)
;
} }
} }
} }
@@ -111,14 +97,23 @@ $(function () {
yAxis: { yAxis: {
min: 0, min: 0,
title: { title: {
text: 'Expense (€)' text: null
} },
labels: {
formatter: function () {
if(this.value >= 1000 || this.value <= -1000) {
return '\u20AC ' + (this.value / 1000) + 'k';
}
return '\u20AC ' + this.value;
}
},
}, },
legend: { legend: {
enabled: false enabled: false
}, },
tooltip: { tooltip: {
pointFormat: 'Total expense: <strong> {point.y:.2f}</strong>', pointFormat: 'Total expense: <strong>\u20AC {point.y:.2f}</strong>',
}, },
plotOptions: { plotOptions: {
column: { column: {
@@ -165,24 +160,27 @@ $(function () {
labels: { labels: {
style: { style: {
fontSize: '11px', fontSize: '11px',
fontFamily: 'Verdana, sans-serif'
} }
} }
}, },
yAxis: {
min: 0,
title: {
text: 'Amount (€)',
align: 'high'
},
labels: {
overflow: 'justify'
}
},
tooltip: { tooltip: {
formatter: function () { formatter: function () {
return false; return this.series.name + ': \u20AC ' + Highcharts.numberFormat(this.y,2);
return '€ ' + Highcharts.numberFormat(this.y, 2); }
},
yAxis: {
min: 0,
title: {text:null},
labels: {
overflow: 'justify',
formatter: function () {
if(this.value >= 1000 || this.value <= -1000) {
return '\u20AC ' + (this.value / 1000) + 'k';
}
return '\u20AC ' + this.value;
}
} }
}, },
plotOptions: { plotOptions: {
@@ -196,22 +194,13 @@ $(function () {
dataLabels: { dataLabels: {
enabled: true, enabled: true,
formatter: function () { formatter: function () {
return ' ' + Highcharts.numberFormat(this.y, 2); return '\u20AC ' + Highcharts.numberFormat(this.y, 2);
} }
} }
} }
}, },
legend: { legend: {
enabled: false, enabled: false,
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -40,
y: 100,
floating: true,
borderWidth: 1,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor || '#FFFFFF'),
shadow: true
}, },
credits: { credits: {
enabled: false enabled: false

File diff suppressed because one or more lines are too long

View File

@@ -1,12 +0,0 @@
/**
* Site-specific configuration settings for Highslide JS
*/
hs.graphicsDir = 'assets/highslide/';
hs.outlineType = 'rounded-white';
hs.wrapperClassName = 'draggable-header';
hs.captionEval = 'this.a.title';
hs.showCredits = false;
hs.marginTop = 20;
hs.marginRight = 20;
hs.marginBottom = 20;
hs.marginLeft = 20;

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 highcharts/highcharts
//= require highslide/highslide.config
//= require_tree highcharts
//= require firefly/index //= require firefly/index