Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMadhura Jayaratne <madhura.cj@gmail.com>2013-01-15 05:38:17 +0400
committerMadhura Jayaratne <madhura.cj@gmail.com>2013-01-15 05:38:17 +0400
commit303e99954470bd394640d381bfddc0fe60b594aa (patch)
treeddd5b4a0976eb043bb4c0f49903b2ad03316abb5 /js/chart.js
parent34c676c1d146a9e0a45d1dd46afe19fb4cfd9c94 (diff)
Validator for timeline charts
Diffstat (limited to 'js/chart.js')
-rw-r--r--js/chart.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/js/chart.js b/js/chart.js
index be1604f1ed..1fa4290d52 100644
--- a/js/chart.js
+++ b/js/chart.js
@@ -92,6 +92,28 @@ PieChart.prototype.validateColumns = function(dataTable) {
};
/**
+ * Abstract timeline chart
+ *
+ * @param elementId
+ * id of the div element the chart is drawn in
+ */
+var TimelineChart = function(elementId) {
+ BaseChart.call(this, elementId);
+};
+TimelineChart.prototype = new BaseChart();
+TimelineChart.prototype.constructor = TimelineChart;
+TimelineChart.prototype.validateColumns = function(dataTable) {
+ var result = BaseChart.prototype.validateColumns.call(this, dataTable);
+ if (result) {
+ var columns = dataTable.getColumns();
+ if (columns[0].type != ColumnType.DATE) {
+ throw new Error("First column of timeline chart need to be a date column");
+ }
+ }
+ return result;
+};
+
+/**
* The data table contains column information and data for the chart.
*/
var DataTable = function() {
@@ -309,6 +331,7 @@ JQPlotLineChart.prototype.prepareData = function(dataTable) {
*/
var JQPloatTimelineChart = function(elementId) {
JQPlotLineChart.call(this, elementId);
+ this.validator = TimelineChart.prototype;
};
JQPloatTimelineChart.prototype = new JQPlotLineChart();
JQPloatTimelineChart.prototype.constructor = JQPlotAreaChart;