From 9bcd27b847fe6120e920a819738ee15d0c15e2ae Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 11 Sep 2014 21:58:08 +0200 Subject: [PATCH] Cleanup and improve charts. --- app/assets/javascripts/accounts.js | 2 - app/assets/javascripts/firefly/accounts.js | 54 ++++++++-------------- 2 files changed, 18 insertions(+), 38 deletions(-) diff --git a/app/assets/javascripts/accounts.js b/app/assets/javascripts/accounts.js index a9d3956059..5f0321dbb0 100644 --- a/app/assets/javascripts/accounts.js +++ b/app/assets/javascripts/accounts.js @@ -10,7 +10,5 @@ // // 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 firefly/accounts diff --git a/app/assets/javascripts/firefly/accounts.js b/app/assets/javascripts/firefly/accounts.js index 2eabb1567c..a5fc3b60f3 100644 --- a/app/assets/javascripts/firefly/accounts.js +++ b/app/assets/javascripts/firefly/accounts.js @@ -12,42 +12,35 @@ if($('#chart').length == 1) { series: data.series, title: { - text: data.chart_title + text: null }, yAxis: { - formatter: function () { - return '$' + Highcharts.numberFormat(this.y, 0); - } - }, - subtitle: { - text: data.subtitle, - useHTML: true - }, + allowDecimals: false, + labels: { + formatter: function () { + if(this.value >= 1000 || this.value <= -1000) { + return '\u20AC ' + (this.value / 1000) + 'k'; + } + return '\u20AC ' + this.value; + } + }, + title: {text: null} + }, xAxis: { - floor: 0, type: 'datetime', dateTimeLabelFormats: { day: '%e %b', - year: '%b' + week: '%e %b' }, title: { - text: 'Date' + text: null } }, + legend: {enabled:false}, tooltip: { - shared: true, - crosshairs: false, formatter: function () { - var str = '' + Highcharts.dateFormat("%A, %e %B", this.x) + '
'; - for (x in this.points) { - var point = this.points[x]; - var colour = point.point.pointAttr[''].fill; - str += '' + point.series.name + ': \u20AC ' + Highcharts.numberFormat(point.y, 2) + '
'; - } - //console.log(); - return str; - return '' + this.series.name + ' on ' + Highcharts.dateFormat("%e %B", this.x) + ':
\u20AC ' + Highcharts.numberFormat(this.y, 2); + return this.series.name + ': \u20AC ' + Highcharts.numberFormat(this.y,2); } }, plotOptions: { @@ -60,23 +53,12 @@ if($('#chart').length == 1) { threshold: 0, lineWidth: 1, marker: { - radius: 2 + radius: 0 }, point: { events: { click: function (e) { - hs.htmlExpand(null, { - src: 'chart/home/info/' + this.series.name + '/' + Highcharts.dateFormat("%d/%m/%Y", this.x), - pageOrigin: { - x: e.pageX, - y: e.pageY - }, - objectType: 'ajax', - headingText: '' + this.series.name + '', - width: 250 - } - ) - ; + alert('click!'); } } }