-{
- "id": "ohai",
- "slug": "ohai",
-
- "name": "ohai~",
- "desc": "A graph for the testing of great justice.",
-
- "dataset": "/data/datasources/rc/rc_page_requests.csv",
- "data" : {
- "metrics" : [
- {
- "source_id" : "rc_page_requests",
- "source_col" : 1,
- "label" : "All Wikipedias (+Mobile)",
- "color" : "#E62F74"
- }, {
- "source_id" : "rc_page_requests",
- "source_col" : 2,
- "label" : "English",
- "color" : "#244792"
- }
- ]
- },
-
- "width": "auto",
- "height": 600,
-
- "parents": [
- "root"
- ],
-
- "chartType": "dygraphs",
- "options": {
- "digitsAfterDecimal": 2,
- "drawPoints": true,
- "labelsKMB": true,
- "logscale": true,
- "pointSize": 1,
- "strokeWidth": 4
- }
-}
+{"options":{"animatedZooms":true,"avoidMinZero":false,"axis":null,"axisLabelColor":"#666666","axisLabelFontSize":11,"axisLabelFormatter":null,"axisLabelWidth":50,"axisLineColor":"#AAAAAA","axisLineWidth":0.3,"axisTickSize":3,"colorSaturation":1,"colorValue":0.5,"colors":["#FF0097","#EF8158","#83BB32","#182B53","#4596FF","#553DC9","#AD3238","#00FFBC","#F1D950"],"connectSeparatedPoints":false,"customBars":false,"dateWindow":null,"delimiter":",","digitsAfterDecimal":2,"displayAnnotations":false,"drawPoints":true,"drawXAxis":true,"drawXGrid":true,"drawYAxis":true,"drawYGrid":true,"errorBars":false,"file":null,"fillAlpha":0.15,"fillGraph":false,"fractions":false,"gridLineColor":"#D8D8D8","gridLineWidth":0.3,"hideOverlayOnMouseOut":false,"highlightCircleSize":4,"includeZero":false,"interactionModel":null,"isZoomedIgnoreProgrammaticZoom":false,"labels":null,"labelsDiv":null,"labelsDivStyles":null,"labelsDivWidth":250,"labelsKMB":true,"labelsKMG2":false,"labelsSeparateLines":true,"labelsShowZeroValues":true,"legend":"always","logscale":true,"maxNumberWidth":30,"panEdgeFraction":null,"pixelsPerLabel":null,"pixelsPerXLabel":null,"pixelsPerYLabel":null,"pointSize":1,"rangeSelectorHeight":40,"rangeSelectorPlotFillColor":"#A7B1C4","rangeSelectorPlotStrokeColor":"#808FAB","rightGap":20,"rollPeriod":1,"showLabelsOnHighlight":true,"showRangeSelector":false,"showRoller":false,"sigFigs":null,"sigma":2,"stackedGraph":false,"stepPlot":false,"strokePattern":null,"strokeWidth":4,"ticker":null,"title":null,"titleHeight":18,"valueFormatter":null,"valueRange":null,"visibility":null,"wilsonInterval":true,"xAxisHeight":null,"xAxisLabelFormatter":null,"xAxisLabelWidth":55,"xLabelHeight":18,"xValueFormatter":null,"xValueParser":null,"xlabel":null,"y2label":null,"yAxisLabelFormatter":null,"yAxisLabelWidth":50,"yLabelWidth":18,"yValueFormatter":null,"ylabel":null},"slug":"ohai","name":"ohai~","desc":"A graph for the testing of great justice.","notes":"","width":"auto","height":250,"chartType":"dygraphs","parents":["root"],"id":"ohai","dataset":"/data/datasources/rc/rc_page_requests.csv","data":{"metrics":[{"source_id":"rc_page_requests","source_col":1,"label":"All Wikipedias (+Mobile)","color":"#E62F74"},{"source_id":"rc_page_requests","source_col":2,"label":"English","color":"#244792"}]}}
\ No newline at end of file
@constructor.register this
@metrics = new MetricList @attributes.metrics
@on 'change:metrics', @onMetricChange, this
- @on 'load-success', @onLoadSuccess, this
+ @load()
canonicalize: (ds) ->
@loadCSV url
default
console.error "#this.load() Unknown Data Format!"
- @trigger 'load-error', this, 'Unknown Data Format!'
+ @onLoadError null, 'Unknown Data Format!', new Error 'Unknown Data Format!'
this
loadJSON: (url) ->
$.ajax do
url : url
dataType : 'json'
- success : (@data) ->
- @trigger 'load-success', this
- error : (jqXHR, txtStatus, err) ->
- @trigger 'load-error', this, txtStatus, err
+ success : @onLoadSuccess
+ error : @onLoadError
this
loadCSV: (url) ->
$.ajax do
url : url
dataType : 'text'
- success : (data) ->
- @data = new CSVData data
- @trigger 'load-success', this
- error : (jqXHR, txtStatus, err) ->
- @trigger 'load-error', this, txtStatus, err
+ success : (data) ~> @onLoadSuccess new CSVData data
+ error : @onLoadError
this
- onLoadSuccess: ->
+ onLoadSuccess: (@data) ->
+ console.log "#this.onLoadSuccess #{@data}"
+ @trigger 'load-success', this
return if @ready
@ready = true
@trigger 'ready', this
onLoadError: (jqXHR, txtStatus, err) ->
@_errorLoading = true
console.error "#this Error loading data! -- #msg: #{err or ''}"
+ @trigger 'load-error', this, txtStatus, err
getData: ->
*/
Metric = exports.Metric = BaseModel.extend do # {{{
urlRoot : '/metrics'
+ ready : false
/**
* Data source of the Metric.
initialize : ->
BaseModel::initialize ...
- @on 'change:source_id', @onUpdateSource, this
- @onUpdateSource()
+ @on 'change:source_id', @lookupSource, this
+ @on 'change:source_col', @onUpdateSourceCol, this
+ @lookupSource()
- onUpdateSource: ->
+ lookupSource: ->
if source_id = @get 'source_id'
@wait()
+ @updateId()
DataSource.lookup source_id, @onSourceReady, this
this
console.error "#this Error loading DataSource! #err"
else
@source = source
+ @updateId()
unless @ready
@ready = true
@trigger 'ready', this
this
+ onUpdateSourceCol: ->
+ @updateId()
+ this
+
+ updateId: ->
+ if (source_id = @get('source_id')) and (source_col = @get('source_col'))
+ @id = "#source_id[#source_col]"
+ this
+
+
/**
* Check whether the metric has aiight-looking values so we don't
* attempt to graph unconfigured crap.