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