@deephaven/chart 0.9.1-alpha.8 → 0.9.1-alpha.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Chart.css CHANGED
@@ -44,13 +44,13 @@
44
44
  .chart-wrapper .js-plotly-plot .plotly .modebar {
45
45
  z-index: auto;
46
46
  }
47
- .chart-wrapper .js-plotly-plot .plotly .modebar .modebar-btn[data-title="Downsampling in progress..."] svg {
47
+ .chart-wrapper .js-plotly-plot .plotly .modebar .modebar-btn[data-attr=animation-spin] svg {
48
48
  animation: fa-spin 2s infinite linear;
49
49
  }
50
- .chart-wrapper .js-plotly-plot .plotly .modebar .modebar-btn[data-title="Downsampling enabled, click to disable"] svg path {
50
+ .chart-wrapper .js-plotly-plot .plotly .modebar .modebar-btn[data-attr=fill-active] svg path {
51
51
  fill: rgba(255, 255, 255, 0.7) !important;
52
52
  }
53
- .chart-wrapper .js-plotly-plot .plotly .modebar .modebar-btn[data-title^="Downsampling failed"] svg path {
53
+ .chart-wrapper .js-plotly-plot .plotly .modebar .modebar-btn[data-attr=fill-warning] svg path {
54
54
  fill: #f37e3f !important;
55
55
  }
56
56
 
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../src/Chart.scss","../../components/scss/bootstrap_overrides.scss"],"names":[],"mappings":"AAYA;EACE,cAV6B;;;AAa/B;EAIE;EACA;EACA;;;AAGF;EACE,YCfc;;ADkBZ;EACE;;AAGF;AAAA;EAEE;;AAGF;EACE;EACA;;AAGF;EACE;;AAGF;EACE,MCnCW;EDoCX,QCtBK;;AD2BT;EACE;EAGA;;AAGF;EACE,eC2DY;ED1DZ,YCvCO;EDwCP,OCnDa;EDoDb;EACA,YCgHiB;ED7GjB;;AAGF;EAEE;;AAKI;EACE;;AAMA;EACE;;AAOF;EACE","file":"Chart.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../src/Chart.scss","../../components/scss/bootstrap_overrides.scss"],"names":[],"mappings":"AAQA;EACE,cAN6B;;;AAS/B;EAIE;EACA;EACA;;;AAGF;EACE,YCXc;;ADcZ;EACE;;AAGF;AAAA;EAEE;;AAGF;EACE;EACA;;AAGF;EACE;;AAGF;EACE,MC/BW;EDgCX,QClBK;;ADuBT;EACE;EAGA;;AAGF;EACE,eC+DY;ED9DZ,YCnCO;EDoCP,OC/Ca;EDgDb;EACA,YCoHiB;EDjHjB;;AAGF;EAEE;;AAII;EACE;;AAMA;EACE;;AAOF;EACE","file":"Chart.css"}
package/dist/Chart.d.ts CHANGED
@@ -10,7 +10,8 @@ export class Chart extends React.Component<any, any, any> {
10
10
  descent: number;
11
11
  transform: string;
12
12
  };
13
- static downsampleButtonTitle(isDownsampleInProgress: any, isDownsamplingDisabled: any): any;
13
+ static downsampleButtonTitle(isDownsampleInProgress: any, isDownsamplingDisabled: any): "Downsampling in progress..." | "Downsampling disabled, click to enable" | "Downsampling enabled, click to disable";
14
+ static downsampleButtonAttr(isDownsampleInProgress: any, isDownsamplingDisabled: any): "animation-spin" | "fill-active" | undefined;
14
15
  constructor(props: any);
15
16
  handleAfterPlot(): void;
16
17
  handleDownsampleClick(): void;
@@ -32,7 +33,7 @@ export class Chart extends React.Component<any, any, any> {
32
33
  displaylogo: boolean;
33
34
  displayModeBar: string | boolean;
34
35
  modeBarButtons: (string[] | {
35
- name: any;
36
+ name: string;
36
37
  icon: {
37
38
  width: any;
38
39
  path: any;
@@ -41,6 +42,7 @@ export class Chart extends React.Component<any, any, any> {
41
42
  transform: string;
42
43
  };
43
44
  click: () => void;
45
+ attr: string | undefined;
44
46
  }[])[];
45
47
  };
46
48
  getPlotRect(): any;
@@ -1 +1 @@
1
- {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../src/Chart.jsx"],"names":[],"mappings":"AAiBA;IACE;;;OAGG;IACH;;;;;;MAWC;IAED,4FAQC;IAED,wBAgCC;IA8HD,wBAIC;IAED,8BAcC;IAED,mCAsEC;IAED,oCAcC;IAED,mCAWC;IAED,0DAYC;IA3RC,2BAA6B;IAC7B,kCAAoC;IACpC,qBAAuB;IACvB,6BAAkC;IAClC,yBAA8B;IAC9B,yBAA8B;IAC9B,UAAgB;IAChB,sBAAkB;IAClB,sBAAyB;IACzB,uBAA0B;IA8C5B;;;;;;;;;;;;;;MAmDE;IAEF,mBAEC;IAED,iBAUC;IAED,kBAYC;IAED,oBAQC;IA2ID;;;;;;;OAOG;IACH,8BAFW,OAAO,QAwBjB;IAED,sBAGC;IAED,6CAmBC;IAED,wBAUC;IAED,yBAcC;CAuCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAmCe,uCAAQ;;QACT,sCAAQ;;QACX,mCAAQ;;QACT,kCAAQ;;QACE,4CAAQ"}
1
+ {"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../src/Chart.jsx"],"names":[],"mappings":"AAgBA;IACE;;;OAGG;IACH;;;;;;MAWC;IAED,4MAQC;IAED,oIAMC;IAED,wBAgCC;IAqID,wBAIC;IAED,8BAcC;IAED,mCAsEC;IAED,oCAcC;IAED,mCAWC;IAED,0DAYC;IAlSC,2BAA6B;IAC7B,kCAAoC;IACpC,qBAAuB;IACvB,6BAAkC;IAClC,yBAA8B;IAC9B,yBAA8B;IAC9B,UAAgB;IAChB,sBAAkB;IAClB,sBAAyB;IACzB,uBAA0B;IA8C5B;;;;;;;;;;;;;;;MA0DE;IAEF,mBAEC;IAED,iBAUC;IAED,kBAYC;IAED,oBAQC;IA2ID;;;;;;;OAOG;IACH,8BAFW,OAAO,QAwBjB;IAED,sBAGC;IAED,6CAmBC;IAED,wBAUC;IAED,yBAcC;CAuCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAmCe,uCAAQ;;QACT,sCAAQ;;QACX,mCAAQ;;QACT,kCAAQ;;QACE,4CAAQ"}
package/dist/Chart.js CHANGED
@@ -15,7 +15,6 @@ import Plotly from "./plotly/Plotly.js";
15
15
  import Plot from "./plotly/Plot.js";
16
16
  import ChartModel from "./ChartModel.js";
17
17
  import ChartUtils from "./ChartUtils.js";
18
- import ChartConstants from "./Chart.module.css";
19
18
  import "./Chart.css";
20
19
  var log = Log.module('Chart');
21
20
  export class Chart extends Component {
@@ -38,10 +37,18 @@ export class Chart extends Component {
38
37
 
39
38
  static downsampleButtonTitle(isDownsampleInProgress, isDownsamplingDisabled) {
40
39
  if (isDownsampleInProgress) {
41
- return ChartConstants['title-downsampling-in-progress'];
40
+ return 'Downsampling in progress...';
42
41
  }
43
42
 
44
- return isDownsamplingDisabled ? ChartConstants['title-downsampling-disabled'] : ChartConstants['title-downsampling-enabled'];
43
+ return isDownsamplingDisabled ? 'Downsampling disabled, click to enable' : 'Downsampling enabled, click to disable';
44
+ }
45
+
46
+ static downsampleButtonAttr(isDownsampleInProgress, isDownsamplingDisabled) {
47
+ if (isDownsampleInProgress) {
48
+ return 'animation-spin';
49
+ }
50
+
51
+ return isDownsamplingDisabled ? undefined : 'fill-active';
45
52
  }
46
53
 
47
54
  constructor(props) {
@@ -52,19 +59,22 @@ export class Chart extends Component {
52
59
 
53
60
  if (downsamplingError) {
54
61
  customButtons.push({
55
- name: "".concat(ChartConstants['title-downsampling-failed'], ": ").concat(downsamplingError),
62
+ name: "Downsampling failed: ".concat(downsamplingError),
56
63
  click: () => {},
57
- icon: Chart.convertIcon(dhWarningFilled)
64
+ icon: Chart.convertIcon(dhWarningFilled),
65
+ attr: 'fill-warning'
58
66
  });
59
67
  }
60
68
 
61
69
  if (isDownsampleFinished || isDownsampleInProgress || isDownsamplingDisabled || downsamplingError) {
62
70
  var name = Chart.downsampleButtonTitle(isDownsampleInProgress, isDownsamplingDisabled);
71
+ var attr = Chart.downsampleButtonAttr(isDownsampleInProgress, isDownsamplingDisabled);
63
72
  var icon = isDownsampleInProgress ? vsLoading : dhGraphLineDown;
64
73
  customButtons.push({
65
74
  name,
66
75
  icon: Chart.convertIcon(icon),
67
- click: this.handleDownsampleClick
76
+ click: this.handleDownsampleClick,
77
+ attr
68
78
  });
69
79
  }
70
80
 
package/dist/Chart.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Chart.jsx"],"names":["React","Component","PropTypes","deepEqual","memoize","vsLoading","dhGraphLineDown","dhWarningFilled","Formatter","FormatterUtils","DateUtils","Log","Plotly","Plot","ChartModel","ChartUtils","ChartConstants","log","module","Chart","convertIcon","faIcon","width","path","icon","ascent","descent","transform","downsampleButtonTitle","isDownsampleInProgress","isDownsamplingDisabled","constructor","props","downsamplingError","isDownsampleFinished","customButtons","push","name","click","handleDownsampleClick","displaylogo","displayModeBar","modeBarButtons","handleAfterPlot","bind","handleModelEvent","handlePlotUpdate","handleRelayout","handleRestyle","plot","createRef","plotWrapper","columnFormats","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","rect","ranges","isSubscribed","isLoadedFired","state","data","layout","datarevision","revision","componentDidMount","updateDimensions","updateModelDimensions","initData","initFormatter","isActive","subscribe","componentDidUpdate","prevProps","settings","updateFormatterSettings","unsubscribe","componentWillUnmount","getPlotRect","current","getBoundingClientRect","model","setState","getData","getLayout","height","debug2","setDownsamplingDisabled","event","type","detail","EVENT_UPDATED","currentSeries","onUpdate","isLoading","EVENT_LOADFINISHED","EVENT_DISCONNECT","onDisconnect","EVENT_RECONNECT","onReconnect","EVENT_DOWNSAMPLESTARTED","EVENT_DOWNSAMPLEFINISHED","EVENT_DOWNSAMPLENEEDED","EVENT_DOWNSAMPLEFAILED","message","onError","Error","debug","figure","getLayoutRanges","isRangesChanged","changes","Object","keys","includes","onSettingsChanged","hiddenSeries","hiddenlabels","seriesIndexes","reduce","acc","visible","force","warn","isRectChanged","setDimensions","getColumnFormats","getDateTimeFormatterOptions","updateFormatter","formatter","setFormatter","relayout","el","autosize","catch","e","render","config","getCachedConfig","isPlotShown","propTypes","instanceOf","isRequired","shape","timeZone","string","defaultDateTimeFormat","showTimeZone","bool","showTSeparator","arrayOf","defaultFormatString","func","defaultProps","FULL_DATE_FORMAT"],"mappings":";;;;;;AAAA,OAA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EAAAA,iBAAiB,EAAEjH,SAAS,CAACsJ;AArBb,CAAlB;AAwBArI,KAAK,CAACsI,YAAN,GAAqB;AACnBnF,EAAAA,QAAQ,EAAE,IADS;AAEnBI,EAAAA,QAAQ,EAAE;AACRsE,IAAAA,QAAQ,EAAE,kBADF;AAERE,IAAAA,qBAAqB,EAAExI,SAAS,CAACgJ,gBAFzB;AAGRP,IAAAA,YAAY,EAAE,KAHN;AAIRE,IAAAA,cAAc,EAAE,IAJR;AAKRpB,IAAAA,SAAS,EAAE;AALH,GAFS;AASnBhC,EAAAA,YAAY,EAAE,MAAM,CAAE,CATH;AAUnBE,EAAAA,WAAW,EAAE,MAAM,CAAE,CAVF;AAWnBN,EAAAA,QAAQ,EAAE,MAAM,CAAE,CAXC;AAYnBY,EAAAA,OAAO,EAAE,MAAM,CAAE,CAZE;AAanBU,EAAAA,iBAAiB,EAAE,MAAM,CAAE;AAbR,CAArB;AAgBA,eAAehG,KAAf","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport deepEqual from 'deep-equal';\nimport memoize from 'memoize-one';\nimport { vsLoading, dhGraphLineDown, dhWarningFilled } from '@deephaven/icons';\nimport { Formatter, FormatterUtils, DateUtils } from '@deephaven/iris-grid';\nimport Log from '@deephaven/log';\nimport Plotly from './plotly/Plotly';\nimport Plot from './plotly/Plot';\n\nimport ChartModel from './ChartModel';\nimport ChartUtils from './ChartUtils';\nimport ChartConstants from './Chart.module.scss';\nimport './Chart.scss';\n\nconst log = Log.module('Chart');\n\nexport class Chart extends Component {\n /**\n * Convert a font awesome icon definition to a plotly icon definition\n * @param {FontAwesome.IconDefinition} faIcon The icon to convert\n */\n static convertIcon(faIcon) {\n const [width, , , , path] = faIcon.icon;\n // By default the icons are flipped upside down, so we need to add our own transform\n // https://github.com/plotly/plotly.js/issues/1335\n return {\n width,\n path,\n ascent: width,\n descent: 0,\n transform: `matrix(1, 0, 0, 1, 0, 0)`,\n };\n }\n\n static downsampleButtonTitle(isDownsampleInProgress, isDownsamplingDisabled) {\n if (isDownsampleInProgress) {\n return ChartConstants['title-downsampling-in-progress'];\n }\n\n return isDownsamplingDisabled\n ? ChartConstants['title-downsampling-disabled']\n : ChartConstants['title-downsampling-enabled'];\n }\n\n constructor(props) {\n super(props);\n\n this.handleAfterPlot = this.handleAfterPlot.bind(this);\n this.handleDownsampleClick = this.handleDownsampleClick.bind(this);\n this.handleModelEvent = this.handleModelEvent.bind(this);\n this.handlePlotUpdate = this.handlePlotUpdate.bind(this);\n this.handleRelayout = this.handleRelayout.bind(this);\n this.handleRestyle = this.handleRestyle.bind(this);\n\n this.plot = React.createRef();\n this.plotWrapper = React.createRef();\n this.columnFormats = [];\n this.dateTimeFormatterOptions = {};\n this.decimalFormatOptions = {};\n this.integerFormatOptions = {};\n this.rect = null;\n this.ranges = null;\n this.isSubscribed = false;\n this.isLoadedFired = false;\n\n this.state = {\n data: null,\n downsamplingError: null,\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n layout: {\n datarevision: 0,\n },\n revision: 0,\n };\n }\n\n componentDidMount() {\n // Need to make sure the model dimensions are up to date before initializing the data\n this.updateDimensions();\n this.updateModelDimensions();\n\n this.initData();\n this.initFormatter();\n\n const { isActive } = this.props;\n if (isActive) {\n this.subscribe();\n }\n }\n\n componentDidUpdate(prevProps) {\n const { isActive, settings } = this.props;\n this.updateFormatterSettings(settings);\n\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.subscribe();\n } else {\n this.unsubscribe();\n }\n }\n }\n\n componentWillUnmount() {\n this.unsubscribe();\n }\n\n getCachedConfig = memoize(\n (\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled\n ) => {\n const customButtons = [];\n if (downsamplingError) {\n customButtons.push({\n name: `${ChartConstants['title-downsampling-failed']}: ${downsamplingError}`,\n click: () => {},\n icon: Chart.convertIcon(dhWarningFilled),\n });\n }\n\n if (\n isDownsampleFinished ||\n isDownsampleInProgress ||\n isDownsamplingDisabled ||\n downsamplingError\n ) {\n const name = Chart.downsampleButtonTitle(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const icon = isDownsampleInProgress ? vsLoading : dhGraphLineDown;\n customButtons.push({\n name,\n icon: Chart.convertIcon(icon),\n click: this.handleDownsampleClick,\n });\n }\n\n return {\n displaylogo: false,\n\n // Display the mode bar if there's an error or downsampling so user can see progress\n // Yes, the value is a boolean or the string 'hover': https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L249\n displayModeBar:\n isDownsampleInProgress || downsamplingError ? true : 'hover',\n\n // Each array gets grouped together in the mode bar\n modeBarButtons: [\n customButtons,\n ['toImage'],\n ['zoom2d', 'pan2d'],\n ['zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d'],\n ],\n };\n }\n );\n\n getPlotRect() {\n return this.plotWrapper.current?.getBoundingClientRect() ?? null;\n }\n\n initData() {\n const { model } = this.props;\n const { layout } = this.state;\n this.setState({\n data: model.getData(),\n layout: {\n ...layout,\n ...model.getLayout(),\n },\n });\n }\n\n subscribe() {\n if (this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n if (!this.rect || this.rect.width === 0 || this.rect.height === 0) {\n log.debug2('Delaying subscription until model dimensions are set');\n return;\n }\n model.subscribe(this.handleModelEvent);\n this.isSubscribed = true;\n }\n\n unsubscribe() {\n if (!this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n model.unsubscribe(this.handleModelEvent);\n this.isSubscribed = false;\n }\n\n handleAfterPlot() {\n if (this.plot.current) {\n // TODO: Translate whatever Don was doing in plotting.js in the afterplot here so that area graphs show up properly\n }\n }\n\n handleDownsampleClick() {\n this.setState(\n ({ isDownsamplingDisabled }) => ({\n downsamplingError: null,\n isDownsampleInProgress: false,\n isDownsampleFinished: false,\n isDownsamplingDisabled: !isDownsamplingDisabled,\n }),\n () => {\n const { model } = this.props;\n const { isDownsamplingDisabled } = this.state;\n model.setDownsamplingDisabled(isDownsamplingDisabled);\n }\n );\n }\n\n handleModelEvent(event) {\n const { type, detail } = event;\n log.debug2('Received data update', type, detail);\n\n switch (type) {\n case ChartModel.EVENT_UPDATED: {\n this.currentSeries += 1;\n this.setState(state => {\n const { layout, revision } = state;\n layout.datarevision += 1;\n return {\n data: detail,\n layout,\n revision: revision + 1,\n };\n });\n\n const { onUpdate } = this.props;\n onUpdate({ isLoading: !this.isLoadedFired });\n break;\n }\n case ChartModel.EVENT_LOADFINISHED: {\n const { onUpdate } = this.props;\n this.isLoadedFired = true;\n onUpdate({ isLoading: false });\n break;\n }\n case ChartModel.EVENT_DISCONNECT: {\n const { onDisconnect } = this.props;\n onDisconnect();\n break;\n }\n case ChartModel.EVENT_RECONNECT: {\n const { onReconnect } = this.props;\n onReconnect();\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLESTARTED: {\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: true,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLEFINISHED: {\n this.setState({\n isDownsampleFinished: true,\n isDownsampleInProgress: false,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLENEEDED:\n case ChartModel.EVENT_DOWNSAMPLEFAILED: {\n const downsamplingError = detail.message ? detail.message : detail;\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n downsamplingError,\n });\n\n const { onError } = this.props;\n onError(new Error(downsamplingError));\n break;\n }\n default:\n log.debug('Unknown event type', type, event);\n }\n }\n\n handlePlotUpdate(figure) {\n // User could have modified zoom/pan here, update the model dimensions\n // We don't need to update the datarevision, as we don't have any data changes\n // until an update comes back from the server anyway\n const { layout } = figure;\n const ranges = ChartUtils.getLayoutRanges(layout);\n\n const isRangesChanged = !deepEqual(ranges, this.ranges);\n\n if (isRangesChanged) {\n this.ranges = ranges;\n\n this.updateModelDimensions(true);\n }\n }\n\n handleRelayout(changes) {\n log.debug('handleRelayout', changes);\n if (Object.keys(changes).includes('hiddenlabels')) {\n const { onSettingsChanged } = this.props;\n // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes\n // Series visibility for other types of charts is handled in handleRestyle\n const hiddenSeries = [...changes.hiddenlabels];\n onSettingsChanged({ hiddenSeries });\n }\n\n this.updateModelDimensions();\n }\n\n handleRestyle([changes, seriesIndexes]) {\n log.debug('handleRestyle', changes, seriesIndexes);\n if (Object.keys(changes).includes('visible')) {\n const { data } = this.state;\n const { onSettingsChanged } = this.props;\n const hiddenSeries = data.reduce(\n (acc, { name, visible }) =>\n visible === 'legendonly' ? [...acc, name] : acc,\n []\n );\n onSettingsChanged({ hiddenSeries });\n }\n }\n\n /**\n * Update the models dimensions and ranges.\n * Note that this will update it all whether the plot size changes OR the range\n * the user is looking at has changed (eg. panning/zooming).\n * Could update each independently, but doing them at the same time keeps the\n * ChartModel API a bit cleaner.\n * @param {boolean} force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)\n */\n updateModelDimensions(force = false) {\n const rect = this.getPlotRect();\n if (!rect) {\n log.warn('Unable to get plotting rect');\n return;\n }\n\n const isRectChanged =\n !this.rect ||\n this.rect.width !== rect.width ||\n this.rect.height !== rect.height;\n\n if (isRectChanged || force) {\n this.rect = rect;\n\n const { isActive, model } = this.props;\n model.setDimensions(rect);\n // We may need to resubscribe if dimensions were too small before\n if (isActive) {\n this.subscribe();\n }\n }\n }\n\n initFormatter() {\n const { settings } = this.props;\n this.updateFormatterSettings(settings);\n }\n\n updateFormatterSettings(settings) {\n const columnFormats = FormatterUtils.getColumnFormats(settings);\n const dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(\n settings\n );\n const { decimalFormatOptions = {}, integerFormatOptions = {} } = settings;\n\n if (\n !deepEqual(this.columnFormats, columnFormats) ||\n !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions) ||\n !deepEqual(this.decimalFormatOptions, decimalFormatOptions) ||\n !deepEqual(this.integerFormatOptions, integerFormatOptions)\n ) {\n this.columnFormats = FormatterUtils.getColumnFormats(settings);\n this.dateTimeFormatterOptions = dateTimeFormatterOptions;\n this.decimalFormatOptions = decimalFormatOptions;\n this.integerFormatOptions = integerFormatOptions;\n this.updateFormatter();\n }\n }\n\n updateFormatter() {\n const formatter = new Formatter(\n this.columnFormats,\n this.dateTimeFormatterOptions,\n this.decimalFormatOptions,\n this.integerFormatOptions\n );\n\n const { model } = this.props;\n model.setFormatter(formatter);\n }\n\n updateDimensions() {\n const rect = this.getPlotRect();\n if (\n this.plot.current != null &&\n rect != null &&\n rect.width > 0 &&\n rect.height > 0\n ) {\n // Call relayout to resize avoiding the debouncing plotly does\n // https://github.com/plotly/plotly.js/issues/2769#issuecomment-402099552\n Plotly.relayout(this.plot.current.el, { autosize: true }).catch(e => {\n log.debug('Unable to resize, promise rejected', e);\n });\n }\n }\n\n render() {\n const {\n data,\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n layout,\n revision,\n } = this.state;\n const config = this.getCachedConfig(\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const isPlotShown = data != null;\n return (\n <div className=\"h-100 w-100 chart-wrapper\" ref={this.plotWrapper}>\n {isPlotShown && (\n <Plot\n ref={this.plot}\n data={data}\n layout={layout}\n revision={revision}\n config={config}\n onAfterPlot={this.handleAfterPlot}\n onRelayout={this.handleRelayout}\n onUpdate={this.handlePlotUpdate}\n onRestyle={this.handleRestyle}\n useResizeHandler\n style={{ height: '100%', width: '100%' }}\n />\n )}\n </div>\n );\n }\n}\n\nChart.propTypes = {\n model: PropTypes.instanceOf(ChartModel).isRequired,\n // These settings come from the redux store\n settings: PropTypes.shape({\n timeZone: PropTypes.string.isRequired,\n defaultDateTimeFormat: PropTypes.string.isRequired,\n showTimeZone: PropTypes.bool.isRequired,\n showTSeparator: PropTypes.bool.isRequired,\n formatter: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n decimalFormatOptions: PropTypes.shape({\n defaultFormatString: PropTypes.string,\n }),\n integerFormatOptions: PropTypes.shape({\n defaultFormatString: PropTypes.string,\n }),\n }),\n isActive: PropTypes.bool,\n onDisconnect: PropTypes.func,\n onReconnect: PropTypes.func,\n onUpdate: PropTypes.func,\n onError: PropTypes.func,\n onSettingsChanged: PropTypes.func,\n};\n\nChart.defaultProps = {\n isActive: true,\n settings: {\n timeZone: 'America/New_York',\n defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,\n showTimeZone: false,\n showTSeparator: true,\n formatter: [],\n },\n onDisconnect: () => {},\n onReconnect: () => {},\n onUpdate: () => {},\n onError: () => {},\n onSettingsChanged: () => {},\n};\n\nexport default Chart;\n"],"file":"Chart.js"}
1
+ {"version":3,"sources":["../src/Chart.jsx"],"names":["React","Component","PropTypes","deepEqual","memoize","vsLoading","dhGraphLineDown","dhWarningFilled","Formatter","FormatterUtils","DateUtils","Log","Plotly","Plot","ChartModel","ChartUtils","log","module","Chart","convertIcon","faIcon","width","path","icon","ascent","descent","transform","downsampleButtonTitle","isDownsampleInProgress","isDownsamplingDisabled","downsampleButtonAttr","undefined","constructor","props","downsamplingError","isDownsampleFinished","customButtons","push","name","click","attr","handleDownsampleClick","displaylogo","displayModeBar","modeBarButtons","handleAfterPlot","bind","handleModelEvent","handlePlotUpdate","handleRelayout","handleRestyle","plot","createRef","plotWrapper","columnFormats","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","rect","ranges","isSubscribed","isLoadedFired","state","data","layout","datarevision","revision","componentDidMount","updateDimensions","updateModelDimensions","initData","initFormatter","isActive","subscribe","componentDidUpdate","prevProps","settings","updateFormatterSettings","unsubscribe","componentWillUnmount","getPlotRect","current","getBoundingClientRect","model","setState","getData","getLayout","height","debug2","setDownsamplingDisabled","event","type","detail","EVENT_UPDATED","currentSeries","onUpdate","isLoading","EVENT_LOADFINISHED","EVENT_DISCONNECT","onDisconnect","EVENT_RECONNECT","onReconnect","EVENT_DOWNSAMPLESTARTED","EVENT_DOWNSAMPLEFINISHED","EVENT_DOWNSAMPLENEEDED","EVENT_DOWNSAMPLEFAILED","message","onError","Error","debug","figure","getLayoutRanges","isRangesChanged","changes","Object","keys","includes","onSettingsChanged","hiddenSeries","hiddenlabels","seriesIndexes","reduce","acc","visible","force","warn","isRectChanged","setDimensions","getColumnFormats","getDateTimeFormatterOptions","updateFormatter","formatter","setFormatter","relayout","el","autosize","catch","e","render","config","getCachedConfig","isPlotShown","propTypes","instanceOf","isRequired","shape","timeZone","string","defaultDateTimeFormat","showTimeZone","bool","showTSeparator","arrayOf","defaultFormatString","func","defaultProps","FULL_DATE_FORMAT"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,OAAP,MAAoB,aAApB;AACA,SAASC,SAAT,EAAoBC,eAApB,EAAqCC,eAArC,QAA4D,kBAA5D;AACA,SAASC,SAAT,EAAoBC,cAApB,EAAoCC,SAApC,QAAqD,sBAArD;AACA,OAAOC,GAAP,MAAgB,gBAAhB;OACOC,M;OACAC,I;OAEAC,U;OACAC,U;;AAGP,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAJ,CAAW,OAAX,CAAZ;AAEA,OAAO,MAAMC,KAAN,SAAoBjB,SAApB,CAA8B;AACnC;AACF;AACA;AACA;AACoB,SAAXkB,WAAW,CAACC,MAAD,EAAS;AACzB,QAAM,CAACC,KAAD,KAAcC,IAAd,IAAsBF,MAAM,CAACG,IAAnC,CADyB,CAEzB;AACA;;AACA,WAAO;AACLF,MAAAA,KADK;AAELC,MAAAA,IAFK;AAGLE,MAAAA,MAAM,EAAEH,KAHH;AAILI,MAAAA,OAAO,EAAE,CAJJ;AAKLC,MAAAA,SAAS;AALJ,KAAP;AAOD;;AAE2B,SAArBC,qBAAqB,CAACC,sBAAD,EAAyBC,sBAAzB,EAAiD;AAC3E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,KAAf","sourcesContent":["import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport deepEqual from 'deep-equal';\nimport memoize from 'memoize-one';\nimport { vsLoading, dhGraphLineDown, dhWarningFilled } from '@deephaven/icons';\nimport { Formatter, FormatterUtils, DateUtils } from '@deephaven/iris-grid';\nimport Log from '@deephaven/log';\nimport Plotly from './plotly/Plotly';\nimport Plot from './plotly/Plot';\n\nimport ChartModel from './ChartModel';\nimport ChartUtils from './ChartUtils';\nimport './Chart.scss';\n\nconst log = Log.module('Chart');\n\nexport class Chart extends Component {\n /**\n * Convert a font awesome icon definition to a plotly icon definition\n * @param {FontAwesome.IconDefinition} faIcon The icon to convert\n */\n static convertIcon(faIcon) {\n const [width, , , , path] = faIcon.icon;\n // By default the icons are flipped upside down, so we need to add our own transform\n // https://github.com/plotly/plotly.js/issues/1335\n return {\n width,\n path,\n ascent: width,\n descent: 0,\n transform: `matrix(1, 0, 0, 1, 0, 0)`,\n };\n }\n\n static downsampleButtonTitle(isDownsampleInProgress, isDownsamplingDisabled) {\n if (isDownsampleInProgress) {\n return 'Downsampling in progress...';\n }\n\n return isDownsamplingDisabled\n ? 'Downsampling disabled, click to enable'\n : 'Downsampling enabled, click to disable';\n }\n\n static downsampleButtonAttr(isDownsampleInProgress, isDownsamplingDisabled) {\n if (isDownsampleInProgress) {\n return 'animation-spin';\n }\n\n return isDownsamplingDisabled ? undefined : 'fill-active';\n }\n\n constructor(props) {\n super(props);\n\n this.handleAfterPlot = this.handleAfterPlot.bind(this);\n this.handleDownsampleClick = this.handleDownsampleClick.bind(this);\n this.handleModelEvent = this.handleModelEvent.bind(this);\n this.handlePlotUpdate = this.handlePlotUpdate.bind(this);\n this.handleRelayout = this.handleRelayout.bind(this);\n this.handleRestyle = this.handleRestyle.bind(this);\n\n this.plot = React.createRef();\n this.plotWrapper = React.createRef();\n this.columnFormats = [];\n this.dateTimeFormatterOptions = {};\n this.decimalFormatOptions = {};\n this.integerFormatOptions = {};\n this.rect = null;\n this.ranges = null;\n this.isSubscribed = false;\n this.isLoadedFired = false;\n\n this.state = {\n data: null,\n downsamplingError: null,\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n layout: {\n datarevision: 0,\n },\n revision: 0,\n };\n }\n\n componentDidMount() {\n // Need to make sure the model dimensions are up to date before initializing the data\n this.updateDimensions();\n this.updateModelDimensions();\n\n this.initData();\n this.initFormatter();\n\n const { isActive } = this.props;\n if (isActive) {\n this.subscribe();\n }\n }\n\n componentDidUpdate(prevProps) {\n const { isActive, settings } = this.props;\n this.updateFormatterSettings(settings);\n\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.subscribe();\n } else {\n this.unsubscribe();\n }\n }\n }\n\n componentWillUnmount() {\n this.unsubscribe();\n }\n\n getCachedConfig = memoize(\n (\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled\n ) => {\n const customButtons = [];\n if (downsamplingError) {\n customButtons.push({\n name: `Downsampling failed: ${downsamplingError}`,\n click: () => {},\n icon: Chart.convertIcon(dhWarningFilled),\n attr: 'fill-warning',\n });\n }\n\n if (\n isDownsampleFinished ||\n isDownsampleInProgress ||\n isDownsamplingDisabled ||\n downsamplingError\n ) {\n const name = Chart.downsampleButtonTitle(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const attr = Chart.downsampleButtonAttr(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n\n const icon = isDownsampleInProgress ? vsLoading : dhGraphLineDown;\n customButtons.push({\n name,\n icon: Chart.convertIcon(icon),\n click: this.handleDownsampleClick,\n attr,\n });\n }\n\n return {\n displaylogo: false,\n\n // Display the mode bar if there's an error or downsampling so user can see progress\n // Yes, the value is a boolean or the string 'hover': https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L249\n displayModeBar:\n isDownsampleInProgress || downsamplingError ? true : 'hover',\n\n // Each array gets grouped together in the mode bar\n modeBarButtons: [\n customButtons,\n ['toImage'],\n ['zoom2d', 'pan2d'],\n ['zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d'],\n ],\n };\n }\n );\n\n getPlotRect() {\n return this.plotWrapper.current?.getBoundingClientRect() ?? null;\n }\n\n initData() {\n const { model } = this.props;\n const { layout } = this.state;\n this.setState({\n data: model.getData(),\n layout: {\n ...layout,\n ...model.getLayout(),\n },\n });\n }\n\n subscribe() {\n if (this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n if (!this.rect || this.rect.width === 0 || this.rect.height === 0) {\n log.debug2('Delaying subscription until model dimensions are set');\n return;\n }\n model.subscribe(this.handleModelEvent);\n this.isSubscribed = true;\n }\n\n unsubscribe() {\n if (!this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n model.unsubscribe(this.handleModelEvent);\n this.isSubscribed = false;\n }\n\n handleAfterPlot() {\n if (this.plot.current) {\n // TODO: Translate whatever Don was doing in plotting.js in the afterplot here so that area graphs show up properly\n }\n }\n\n handleDownsampleClick() {\n this.setState(\n ({ isDownsamplingDisabled }) => ({\n downsamplingError: null,\n isDownsampleInProgress: false,\n isDownsampleFinished: false,\n isDownsamplingDisabled: !isDownsamplingDisabled,\n }),\n () => {\n const { model } = this.props;\n const { isDownsamplingDisabled } = this.state;\n model.setDownsamplingDisabled(isDownsamplingDisabled);\n }\n );\n }\n\n handleModelEvent(event) {\n const { type, detail } = event;\n log.debug2('Received data update', type, detail);\n\n switch (type) {\n case ChartModel.EVENT_UPDATED: {\n this.currentSeries += 1;\n this.setState(state => {\n const { layout, revision } = state;\n layout.datarevision += 1;\n return {\n data: detail,\n layout,\n revision: revision + 1,\n };\n });\n\n const { onUpdate } = this.props;\n onUpdate({ isLoading: !this.isLoadedFired });\n break;\n }\n case ChartModel.EVENT_LOADFINISHED: {\n const { onUpdate } = this.props;\n this.isLoadedFired = true;\n onUpdate({ isLoading: false });\n break;\n }\n case ChartModel.EVENT_DISCONNECT: {\n const { onDisconnect } = this.props;\n onDisconnect();\n break;\n }\n case ChartModel.EVENT_RECONNECT: {\n const { onReconnect } = this.props;\n onReconnect();\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLESTARTED: {\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: true,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLEFINISHED: {\n this.setState({\n isDownsampleFinished: true,\n isDownsampleInProgress: false,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLENEEDED:\n case ChartModel.EVENT_DOWNSAMPLEFAILED: {\n const downsamplingError = detail.message ? detail.message : detail;\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n downsamplingError,\n });\n\n const { onError } = this.props;\n onError(new Error(downsamplingError));\n break;\n }\n default:\n log.debug('Unknown event type', type, event);\n }\n }\n\n handlePlotUpdate(figure) {\n // User could have modified zoom/pan here, update the model dimensions\n // We don't need to update the datarevision, as we don't have any data changes\n // until an update comes back from the server anyway\n const { layout } = figure;\n const ranges = ChartUtils.getLayoutRanges(layout);\n\n const isRangesChanged = !deepEqual(ranges, this.ranges);\n\n if (isRangesChanged) {\n this.ranges = ranges;\n\n this.updateModelDimensions(true);\n }\n }\n\n handleRelayout(changes) {\n log.debug('handleRelayout', changes);\n if (Object.keys(changes).includes('hiddenlabels')) {\n const { onSettingsChanged } = this.props;\n // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes\n // Series visibility for other types of charts is handled in handleRestyle\n const hiddenSeries = [...changes.hiddenlabels];\n onSettingsChanged({ hiddenSeries });\n }\n\n this.updateModelDimensions();\n }\n\n handleRestyle([changes, seriesIndexes]) {\n log.debug('handleRestyle', changes, seriesIndexes);\n if (Object.keys(changes).includes('visible')) {\n const { data } = this.state;\n const { onSettingsChanged } = this.props;\n const hiddenSeries = data.reduce(\n (acc, { name, visible }) =>\n visible === 'legendonly' ? [...acc, name] : acc,\n []\n );\n onSettingsChanged({ hiddenSeries });\n }\n }\n\n /**\n * Update the models dimensions and ranges.\n * Note that this will update it all whether the plot size changes OR the range\n * the user is looking at has changed (eg. panning/zooming).\n * Could update each independently, but doing them at the same time keeps the\n * ChartModel API a bit cleaner.\n * @param {boolean} force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)\n */\n updateModelDimensions(force = false) {\n const rect = this.getPlotRect();\n if (!rect) {\n log.warn('Unable to get plotting rect');\n return;\n }\n\n const isRectChanged =\n !this.rect ||\n this.rect.width !== rect.width ||\n this.rect.height !== rect.height;\n\n if (isRectChanged || force) {\n this.rect = rect;\n\n const { isActive, model } = this.props;\n model.setDimensions(rect);\n // We may need to resubscribe if dimensions were too small before\n if (isActive) {\n this.subscribe();\n }\n }\n }\n\n initFormatter() {\n const { settings } = this.props;\n this.updateFormatterSettings(settings);\n }\n\n updateFormatterSettings(settings) {\n const columnFormats = FormatterUtils.getColumnFormats(settings);\n const dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(\n settings\n );\n const { decimalFormatOptions = {}, integerFormatOptions = {} } = settings;\n\n if (\n !deepEqual(this.columnFormats, columnFormats) ||\n !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions) ||\n !deepEqual(this.decimalFormatOptions, decimalFormatOptions) ||\n !deepEqual(this.integerFormatOptions, integerFormatOptions)\n ) {\n this.columnFormats = FormatterUtils.getColumnFormats(settings);\n this.dateTimeFormatterOptions = dateTimeFormatterOptions;\n this.decimalFormatOptions = decimalFormatOptions;\n this.integerFormatOptions = integerFormatOptions;\n this.updateFormatter();\n }\n }\n\n updateFormatter() {\n const formatter = new Formatter(\n this.columnFormats,\n this.dateTimeFormatterOptions,\n this.decimalFormatOptions,\n this.integerFormatOptions\n );\n\n const { model } = this.props;\n model.setFormatter(formatter);\n }\n\n updateDimensions() {\n const rect = this.getPlotRect();\n if (\n this.plot.current != null &&\n rect != null &&\n rect.width > 0 &&\n rect.height > 0\n ) {\n // Call relayout to resize avoiding the debouncing plotly does\n // https://github.com/plotly/plotly.js/issues/2769#issuecomment-402099552\n Plotly.relayout(this.plot.current.el, { autosize: true }).catch(e => {\n log.debug('Unable to resize, promise rejected', e);\n });\n }\n }\n\n render() {\n const {\n data,\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n layout,\n revision,\n } = this.state;\n const config = this.getCachedConfig(\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const isPlotShown = data != null;\n return (\n <div className=\"h-100 w-100 chart-wrapper\" ref={this.plotWrapper}>\n {isPlotShown && (\n <Plot\n ref={this.plot}\n data={data}\n layout={layout}\n revision={revision}\n config={config}\n onAfterPlot={this.handleAfterPlot}\n onRelayout={this.handleRelayout}\n onUpdate={this.handlePlotUpdate}\n onRestyle={this.handleRestyle}\n useResizeHandler\n style={{ height: '100%', width: '100%' }}\n />\n )}\n </div>\n );\n }\n}\n\nChart.propTypes = {\n model: PropTypes.instanceOf(ChartModel).isRequired,\n // These settings come from the redux store\n settings: PropTypes.shape({\n timeZone: PropTypes.string.isRequired,\n defaultDateTimeFormat: PropTypes.string.isRequired,\n showTimeZone: PropTypes.bool.isRequired,\n showTSeparator: PropTypes.bool.isRequired,\n formatter: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n decimalFormatOptions: PropTypes.shape({\n defaultFormatString: PropTypes.string,\n }),\n integerFormatOptions: PropTypes.shape({\n defaultFormatString: PropTypes.string,\n }),\n }),\n isActive: PropTypes.bool,\n onDisconnect: PropTypes.func,\n onReconnect: PropTypes.func,\n onUpdate: PropTypes.func,\n onError: PropTypes.func,\n onSettingsChanged: PropTypes.func,\n};\n\nChart.defaultProps = {\n isActive: true,\n settings: {\n timeZone: 'America/New_York',\n defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,\n showTimeZone: false,\n showTSeparator: true,\n formatter: [],\n },\n onDisconnect: () => {},\n onReconnect: () => {},\n onUpdate: () => {},\n onError: () => {},\n onSettingsChanged: () => {},\n};\n\nexport default Chart;\n"],"file":"Chart.js"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/chart",
3
- "version": "0.9.1-alpha.8+4816848",
3
+ "version": "0.9.1-alpha.9+a5369f1",
4
4
  "description": "Deephaven Chart",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -34,9 +34,9 @@
34
34
  "start": "cross-env NODE_ENV=development npm run watch"
35
35
  },
36
36
  "dependencies": {
37
- "@deephaven/icons": "^0.9.1-alpha.8+4816848",
38
- "@deephaven/iris-grid": "^0.9.1-alpha.8+4816848",
39
- "@deephaven/jsapi-shim": "^0.9.1-alpha.8+4816848",
37
+ "@deephaven/icons": "^0.9.1-alpha.9+a5369f1",
38
+ "@deephaven/iris-grid": "^0.9.1-alpha.9+a5369f1",
39
+ "@deephaven/jsapi-shim": "^0.9.1-alpha.9+a5369f1",
40
40
  "deep-equal": "^2.0.4",
41
41
  "lodash.debounce": "^4.0.8",
42
42
  "memoize-one": "^5.1.1",
@@ -51,9 +51,9 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "@babel/cli": "^7.16.0",
54
- "@deephaven/log": "^0.9.1-alpha.8+4816848",
55
- "@deephaven/mocks": "^0.9.1-alpha.8+4816848",
56
- "@deephaven/tsconfig": "^0.9.1-alpha.8+4816848",
54
+ "@deephaven/log": "^0.9.1-alpha.9+a5369f1",
55
+ "@deephaven/mocks": "^0.9.1-alpha.9+a5369f1",
56
+ "@deephaven/tsconfig": "^0.9.1-alpha.9+a5369f1",
57
57
  "@types/react": "^16.14.8",
58
58
  "@types/react-dom": "^16.9.13",
59
59
  "cross-env": "^7.0.2",
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "481684819a21a2839b424d0dfce542b09bd8fd58"
75
+ "gitHead": "a5369f13b4b006c63889c4228ac17bd3566eace2"
76
76
  }
@@ -1,65 +0,0 @@
1
- .plotly-notifier {
2
- margin-right: 15px;
3
- }
4
-
5
- .plotly-notifier .notifier-note {
6
- border: 0 !important;
7
- border-radius: 2px !important;
8
- background: #555356 !important;
9
- }
10
-
11
- .chart-wrapper {
12
- background: #2d2a2e;
13
- }
14
- .chart-wrapper .plot-container .cartesianlayer text {
15
- user-select: none;
16
- }
17
- .chart-wrapper .plot-container .hovertext path,
18
- .chart-wrapper .plot-container .axistext path {
19
- stroke: none !important;
20
- }
21
- .chart-wrapper .plot-container .axistext path {
22
- fill: #555356 !important;
23
- box-shadow: 4px 4px #1a171a;
24
- }
25
- .chart-wrapper .plot-container .zoomlayer .zoombox {
26
- fill: rgba(0, 0, 0, 0.5) !important;
27
- }
28
- .chart-wrapper .plot-container .zoomlayer .zoombox-corners {
29
- fill: #f0f0ee;
30
- stroke: #211f22;
31
- }
32
- .chart-wrapper .js-plotly-plot .plotly [data-title]::before {
33
- border-color: transparent transparent #403e41;
34
- z-index: 1002;
35
- }
36
- .chart-wrapper .js-plotly-plot .plotly [data-title]::after {
37
- border-radius: 4px;
38
- background: #403e41;
39
- color: #f0f0ee;
40
- padding: 0.25rem 0.5rem;
41
- box-shadow: 0 0.1rem 1.5rem 0.1rem rgba(26, 23, 26, 0.8);
42
- z-index: 1001;
43
- }
44
- .chart-wrapper .js-plotly-plot .plotly .modebar {
45
- z-index: auto;
46
- }
47
- .chart-wrapper .js-plotly-plot .plotly .modebar .modebar-btn[data-title="Downsampling in progress..."] svg {
48
- animation: fa-spin 2s infinite linear;
49
- }
50
- .chart-wrapper .js-plotly-plot .plotly .modebar .modebar-btn[data-title="Downsampling enabled, click to disable"] svg path {
51
- fill: rgba(255, 255, 255, 0.7) !important;
52
- }
53
- .chart-wrapper .js-plotly-plot .plotly .modebar .modebar-btn[data-title^="Downsampling failed"] svg path {
54
- fill: #f37e3f !important;
55
- }
56
-
57
- /* stylelint-disable property-no-unknown */
58
- :export {
59
- title-downsampling-in-progress: Downsampling in progress...;
60
- title-downsampling-failed: Downsampling failed;
61
- title-downsampling-enabled: Downsampling enabled, click to disable;
62
- title-downsampling-disabled: Downsampling disabled, click to enable;
63
- }
64
-
65
- /*# sourceMappingURL=Chart.module.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sourceRoot":"","sources":["../src/Chart.scss","../../components/scss/bootstrap_overrides.scss","../src/Chart.module.scss"],"names":[],"mappings":"AAYA;EACE,cAV6B;;;AAa/B;EAIE;EACA;EACA;;;AAGF;EACE,YCfc;;ADkBZ;EACE;;AAGF;AAAA;EAEE;;AAGF;EACE;EACA;;AAGF;EACE;;AAGF;EACE,MCnCW;EDoCX,QCtBK;;AD2BT;EACE;EAGA;;AAGF;EACE,eC2DY;ED1DZ,YCvCO;EDwCP,OCnDa;EDoDb;EACA,YCgHiB;ED7GjB;;AAGF;EAEE;;AAKI;EACE;;AAMA;EACE;;AAOF;EACE;;;AE5FZ;AACA;EACE;EACA;EACA;EACA","file":"Chart.module.css"}