diff options
author | Madhura Jayaratne <madhura.cj@gmail.com> | 2014-05-08 20:06:31 +0400 |
---|---|---|
committer | Madhura Jayaratne <madhura.cj@gmail.com> | 2014-05-08 20:06:31 +0400 |
commit | 75c7ad38279974c1fc52fd5467f88357b97df847 (patch) | |
tree | c64a277e853a201a98f7fab3a83aa5a0ccfda9e1 /js/chart.js | |
parent | 909e2785b555bb895c00891df43f78ff704f082b (diff) |
Define the factory method last so the chart classes are defined by then
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Diffstat (limited to 'js/chart.js')
-rw-r--r-- | js/chart.js | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/js/chart.js b/js/chart.js index b99627173f..8edb084479 100644 --- a/js/chart.js +++ b/js/chart.js @@ -197,44 +197,6 @@ var DataTable = function () { ******************************************************************************/ /** - * Chart factory that returns JQPlotCharts - */ -var JQPlotChartFactory = function () { -}; -JQPlotChartFactory.prototype = new ChartFactory(); -JQPlotChartFactory.prototype.createChart = function (type, elementId) { - var chart = null; - switch (type) { - case ChartType.LINE: - chart = new JQPlotLineChart(elementId); - break; - case ChartType.SPLINE: - chart = new JQPlotSplineChart(elementId); - break; - case ChartType.TIMELINE: - chart = new JQPlotTimelineChart(elementId); - break; - case ChartType.AREA: - chart = new JQPlotAreaChart(elementId); - break; - case ChartType.BAR: - chart = new JQPlotBarChart(elementId); - break; - case ChartType.COLUMN: - chart = new JQPlotColumnChart(elementId); - break; - case ChartType.PIE: - chart = new JQPlotPieChart(elementId); - break; - case ChartType.SCATTER: - chart = new JQPlotScatterChart(elementId); - break; - } - - return chart; -}; - -/** * Abstract JQplot chart * * @param elementId @@ -653,3 +615,42 @@ JQPlotPieChart.prototype.prepareData = function (dataTable) { } return [ retData ]; }; + +/** + * Chart factory that returns JQPlotCharts + */ +var JQPlotChartFactory = function () { +}; +JQPlotChartFactory.prototype = new ChartFactory(); +JQPlotChartFactory.prototype.createChart = function (type, elementId) { + var chart = null; + switch (type) { + case ChartType.LINE: + chart = new JQPlotLineChart(elementId); + break; + case ChartType.SPLINE: + chart = new JQPlotSplineChart(elementId); + break; + case ChartType.TIMELINE: + chart = new JQPlotTimelineChart(elementId); + break; + case ChartType.AREA: + chart = new JQPlotAreaChart(elementId); + break; + case ChartType.BAR: + chart = new JQPlotBarChart(elementId); + break; + case ChartType.COLUMN: + chart = new JQPlotColumnChart(elementId); + break; + case ChartType.PIE: + chart = new JQPlotPieChart(elementId); + break; + case ChartType.SCATTER: + chart = new JQPlotScatterChart(elementId); + break; + } + + return chart; +}; + |