| 1 | 'use strict' |
| 2 | |
| 3 | import * as DygraphTickers from './dygraph-tickers'; |
| 4 | import DygraphInteraction from './dygraph-interaction-model'; |
| 5 | import DygraphCanvasRenderer from './dygraph-canvas'; |
| 6 | import * as utils from './dygraph-utils'; |
| 7 | |
| 8 | // Default attribute values. |
| 9 | var DEFAULT_ATTRS = { |
| 10 | highlightCircleSize: 3, |
| 11 | highlightSeriesOpts: null, |
| 12 | highlightSeriesBackgroundAlpha: 0.5, |
| 13 | |
| 14 | labelsDivWidth: 250, |
| 15 | labelsDivStyles: { |
| 16 | // TODO(danvk): move defaults from createStatusMessage_ here. |
| 17 | }, |
| 18 | labelsSeparateLines: false, |
| 19 | labelsShowZeroValues: true, |
| 20 | labelsKMB: false, |
| 21 | labelsKMG2: false, |
| 22 | showLabelsOnHighlight: true, |
| 23 | |
| 24 | digitsAfterDecimal: 2, |
| 25 | maxNumberWidth: 6, |
| 26 | sigFigs: null, |
| 27 | |
| 28 | strokeWidth: 1.0, |
| 29 | strokeBorderWidth: 0, |
| 30 | strokeBorderColor: "white", |
| 31 | |
| 32 | axisTickSize: 3, |
| 33 | axisLabelFontSize: 14, |
| 34 | rightGap: 5, |
| 35 | |
| 36 | showRoller: false, |
| 37 | xValueParser: undefined, |
| 38 | |
| 39 | delimiter: ',', |
| 40 | |
| 41 | sigma: 2.0, |
| 42 | errorBars: false, |
| 43 | fractions: false, |
| 44 | wilsonInterval: true, // only relevant if fractions is true |
| 45 | customBars: false, |
| 46 | fillGraph: false, |
| 47 | fillAlpha: 0.15, |
| 48 | connectSeparatedPoints: false, |
| 49 | |
| 50 | stackedGraph: false, |
| 51 | stackedGraphNaNFill: 'all', |
| 52 | hideOverlayOnMouseOut: true, |
| 53 | |
| 54 | legend: 'onmouseover', |
| 55 | stepPlot: false, |
| 56 | avoidMinZero: false, |
| 57 | xRangePad: 0, |
| 58 | yRangePad: null, |
| 59 | drawAxesAtZero: false, |
| 60 | |
| 61 | // Sizes of the various chart labels. |
| 62 | titleHeight: 28, |
| 63 | xLabelHeight: 18, |
| 64 | yLabelWidth: 18, |
| 65 | |
| 66 | axisLineColor: "black", |
| 67 | axisLineWidth: 0.3, |
| 68 | gridLineWidth: 0.3, |
| 69 | axisLabelColor: "black", |
| 70 | axisLabelWidth: 50, |
| 71 | gridLineColor: "rgb(128,128,128)", |
| 72 | |
| 73 | interactionModel: DygraphInteraction.defaultModel, |
| 74 | animatedZooms: false, // (for now) |
| 75 | |
| 76 | // Range selector options |
| 77 | showRangeSelector: false, |
| 78 | rangeSelectorHeight: 40, |
| 79 | rangeSelectorPlotStrokeColor: "#808FAB", |
| 80 | rangeSelectorPlotFillGradientColor: "white", |
| 81 | rangeSelectorPlotFillColor: "#A7B1C4", |
| 82 | rangeSelectorBackgroundStrokeColor: "gray", |
| 83 | rangeSelectorBackgroundLineWidth: 1, |
| 84 | rangeSelectorPlotLineWidth:1.5, |
| 85 | rangeSelectorForegroundStrokeColor: "black", |
| 86 | rangeSelectorForegroundLineWidth: 1, |
| 87 | rangeSelectorAlpha: 0.6, |
| 88 | showInRangeSelector: null, |
| 89 | |
| 90 | // The ordering here ensures that central lines always appear above any |
| 91 | // fill bars/error bars. |
| 92 | plotter: [ |
| 93 | DygraphCanvasRenderer._fillPlotter, |
| 94 | DygraphCanvasRenderer._errorPlotter, |
| 95 | DygraphCanvasRenderer._linePlotter |
| 96 | ], |
| 97 | |
| 98 | plugins: [ ], |
| 99 | |
| 100 | // per-axis options |
| 101 | axes: { |
| 102 | x: { |
| 103 | pixelsPerLabel: 70, |
| 104 | axisLabelWidth: 60, |
| 105 | axisLabelFormatter: utils.dateAxisLabelFormatter, |
| 106 | valueFormatter: utils.dateValueFormatter, |
| 107 | drawGrid: true, |
| 108 | drawAxis: true, |
| 109 | independentTicks: true, |
| 110 | ticker: DygraphTickers.dateTicker |
| 111 | }, |
| 112 | y: { |
| 113 | axisLabelWidth: 50, |
| 114 | pixelsPerLabel: 30, |
| 115 | valueFormatter: utils.numberValueFormatter, |
| 116 | axisLabelFormatter: utils.numberAxisLabelFormatter, |
| 117 | drawGrid: true, |
| 118 | drawAxis: true, |
| 119 | independentTicks: true, |
| 120 | ticker: DygraphTickers.numericTicks |
| 121 | }, |
| 122 | y2: { |
| 123 | axisLabelWidth: 50, |
| 124 | pixelsPerLabel: 30, |
| 125 | valueFormatter: utils.numberValueFormatter, |
| 126 | axisLabelFormatter: utils.numberAxisLabelFormatter, |
| 127 | drawAxis: true, // only applies when there are two axes of data. |
| 128 | drawGrid: false, |
| 129 | independentTicks: false, |
| 130 | ticker: DygraphTickers.numericTicks |
| 131 | } |
| 132 | } |
| 133 | }; |
| 134 | |
| 135 | export default DEFAULT_ATTRS; |