Created
June 1, 2015 20:50
-
-
Save zxqx/7d52164bade0873ed000 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var __extends = require('dotmvc/lib/util/extends'); | |
var __mixin = require('dotmvc/lib/util/mixin'); | |
var KendoChart = require('./KendoChart.js'); | |
var KendoXYSparkline = require('./KendoXYSparkline.js'); | |
// Configs | |
var SeriesDefaults = require('./config/SeriesDefaults.js'); | |
var AxisDefaults = require('./config/AxisDefaults.js'); | |
var Series = require('./config/Series.js'); | |
var CategoryAxis = require('./config/CategoryAxis.js'); | |
var ValueAxis = require('./config/ValueAxis.js'); | |
var Tooltip = require('./config/Tooltip.js'); | |
var DataSource = require('./config/DataSource.js'); | |
module.exports = (function(_super) { | |
__extends(KendoXYChart, _super); | |
__mixin(KendoXYChart, SeriesDefaults); | |
__mixin(KendoXYChart, AxisDefaults); | |
__mixin(KendoXYChart, Series); | |
__mixin(KendoXYChart, CategoryAxis); | |
__mixin(KendoXYChart, ValueAxis); | |
__mixin(KendoXYChart, Tooltip); | |
__mixin(KendoXYChart, DataSource); | |
KendoXYChart.COMPACT_VIEW = KendoXYSparkline; | |
function KendoXYChart() | |
{ | |
_super.apply(this, arguments); | |
} | |
KendoXYChart.prototype.render = function() | |
{ | |
if (!this.context) return; | |
if (!this.context.data) return; | |
this.setSeriesDefaults(); | |
this.setSeriesType('line'); | |
this.setAxisDefaults(); | |
this.setCategoryAxis(); | |
this.setValueAxis(); | |
this.setTooltip(); | |
if (this.context.xField && this.context.yField) { | |
this.setCategoryAxis({ | |
field: this.context.xField, | |
type: this.context.xFieldType | |
}); | |
this.setSeries([{ | |
field: this.context.yField | |
}]); | |
this.setDataSource({ | |
sort: { | |
field: this.context.xField | |
} | |
}); | |
this.setTooltipTemplate( | |
'<span class="k-tooltip-value">#= dataItem.valueFormatted #</span>' + | |
'<span class="k-tooltip-display">#= dataItem.y_display #</span>' + | |
'<span class="k-tooltip-date">' + | |
'#= dataItem.since.format("MMM D, YYYY") # - ' + | |
'#= dataItem.until.format("MMM D, YYYY") #' + | |
'</span>'); | |
} | |
_super.prototype.render.call(this); | |
}; | |
// no-op base class method | |
KendoXYChart.prototype.setLabelSkip = function() | |
{ | |
}; | |
return KendoXYChart; | |
})(KendoChart); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment