Migrate most of core dygraphs to ES6 modules.
[dygraphs.git] / src / dygraph-default-attrs.js
diff --git a/src/dygraph-default-attrs.js b/src/dygraph-default-attrs.js
new file mode 100644 (file)
index 0000000..b7dd6e4
--- /dev/null
@@ -0,0 +1,135 @@
+'use strict'
+
+import * as DygraphTickers from './dygraph-tickers';
+import DygraphInteraction from './dygraph-interaction-model';
+import DygraphCanvasRenderer from './dygraph-canvas';
+import * as utils from './dygraph-utils';
+
+// Default attribute values.
+var DEFAULT_ATTRS = {
+  highlightCircleSize: 3,
+  highlightSeriesOpts: null,
+  highlightSeriesBackgroundAlpha: 0.5,
+
+  labelsDivWidth: 250,
+  labelsDivStyles: {
+    // TODO(danvk): move defaults from createStatusMessage_ here.
+  },
+  labelsSeparateLines: false,
+  labelsShowZeroValues: true,
+  labelsKMB: false,
+  labelsKMG2: false,
+  showLabelsOnHighlight: true,
+
+  digitsAfterDecimal: 2,
+  maxNumberWidth: 6,
+  sigFigs: null,
+
+  strokeWidth: 1.0,
+  strokeBorderWidth: 0,
+  strokeBorderColor: "white",
+
+  axisTickSize: 3,
+  axisLabelFontSize: 14,
+  rightGap: 5,
+
+  showRoller: false,
+  xValueParser: utils.dateParser,
+
+  delimiter: ',',
+
+  sigma: 2.0,
+  errorBars: false,
+  fractions: false,
+  wilsonInterval: true,  // only relevant if fractions is true
+  customBars: false,
+  fillGraph: false,
+  fillAlpha: 0.15,
+  connectSeparatedPoints: false,
+
+  stackedGraph: false,
+  stackedGraphNaNFill: 'all',
+  hideOverlayOnMouseOut: true,
+
+  legend: 'onmouseover',
+  stepPlot: false,
+  avoidMinZero: false,
+  xRangePad: 0,
+  yRangePad: null,
+  drawAxesAtZero: false,
+
+  // Sizes of the various chart labels.
+  titleHeight: 28,
+  xLabelHeight: 18,
+  yLabelWidth: 18,
+
+  axisLineColor: "black",
+  axisLineWidth: 0.3,
+  gridLineWidth: 0.3,
+  axisLabelColor: "black",
+  axisLabelWidth: 50,
+  gridLineColor: "rgb(128,128,128)",
+
+  interactionModel: DygraphInteraction.defaultModel,
+  animatedZooms: false,  // (for now)
+
+  // Range selector options
+  showRangeSelector: false,
+  rangeSelectorHeight: 40,
+  rangeSelectorPlotStrokeColor: "#808FAB",
+  rangeSelectorPlotFillGradientColor: "white",
+  rangeSelectorPlotFillColor: "#A7B1C4",
+  rangeSelectorBackgroundStrokeColor: "gray",
+  rangeSelectorBackgroundLineWidth: 1,
+  rangeSelectorPlotLineWidth:1.5,
+  rangeSelectorForegroundStrokeColor: "black",
+  rangeSelectorForegroundLineWidth: 1,
+  rangeSelectorAlpha: 0.6,
+  showInRangeSelector: null,
+
+  // The ordering here ensures that central lines always appear above any
+  // fill bars/error bars.
+  plotter: [
+    DygraphCanvasRenderer._fillPlotter,
+    DygraphCanvasRenderer._errorPlotter,
+    DygraphCanvasRenderer._linePlotter
+  ],
+
+  plugins: [ ],
+
+  // per-axis options
+  axes: {
+    x: {
+      pixelsPerLabel: 70,
+      axisLabelWidth: 60,
+      axisLabelFormatter: utils.dateAxisLabelFormatter,
+      valueFormatter: utils.dateValueFormatter,
+      drawGrid: true,
+      drawAxis: true,
+      independentTicks: true,
+      ticker: DygraphTickers.dateTicker
+    },
+    y: {
+      axisLabelWidth: 50,
+      pixelsPerLabel: 30,
+      valueFormatter: utils.numberValueFormatter,
+      axisLabelFormatter: utils.numberAxisLabelFormatter,
+      drawGrid: true,
+      drawAxis: true,
+      independentTicks: true,
+      ticker: DygraphTickers.numericTicks
+    },
+    y2: {
+      axisLabelWidth: 50,
+      pixelsPerLabel: 30,
+      valueFormatter: utils.numberValueFormatter,
+      axisLabelFormatter: utils.numberAxisLabelFormatter,
+      drawAxis: true,  // only applies when there are two axes of data.
+      drawGrid: false,
+      independentTicks: false,
+      ticker: DygraphTickers.numericTicks
+    }
+  }
+};
+
+export default DEFAULT_ATTRS;