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