returned data needs to be normalized per stats type

This commit is contained in:
Sven Fuchs 2012-08-19 14:08:58 +02:00
parent e61a2a34be
commit a7b72a2bd4
2 changed files with 6 additions and 2 deletions

View File

@ -7,7 +7,7 @@
renderChart: (config) -> renderChart: (config) ->
chart = new Highcharts.Chart(config) chart = new Highcharts.Chart(config)
@fetch config.source, (data) -> @fetch config.source, (data) ->
stats = ([Date.parse(stats.date), stats.total_growth] for stats in data.stats) stats = (config.map(stats) for stats in data.stats)
chart.series[0].setData(stats) chart.series[0].setData(stats)
fetch: (url, callback) -> fetch: (url, callback) ->
@ -20,6 +20,8 @@
CHARTS: CHARTS:
repos: repos:
source: '/stats/repos' source: '/stats/repos'
map: (data) ->
[Date.parse(data.date), data.total_growth]
chart: chart:
renderTo: "repos_stats" renderTo: "repos_stats"
title: title:
@ -43,6 +45,8 @@
builds: builds:
source: '/stats/tests' source: '/stats/tests'
map: (data) ->
[Date.parse(data.date), data.run_on_date]
chart: chart:
renderTo: "tests_stats" renderTo: "tests_stats"
type: "column" type: "column"

File diff suppressed because one or more lines are too long