From a0eb476e8cbc5f528c70fece56aa34a059172a36 Mon Sep 17 00:00:00 2001 From: jstray Date: Sat, 18 Feb 2017 18:21:59 -0500 Subject: [PATCH 1/5] Get things working as a library --- src/js/stores/SessionStore.js | 2 +- src/js/util/parse-delimited-input.js | 2 ++ src/js/util/validate-data-input.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/stores/SessionStore.js b/src/js/stores/SessionStore.js index 71139caf..a9efd595 100644 --- a/src/js/stores/SessionStore.js +++ b/src/js/stores/SessionStore.js @@ -11,7 +11,7 @@ var _session = { emSize: 10, width: 640, timerOn: (localStorage.hasOwnProperty("model") === true), - nowOffset: getTZOffset(now), + nowOffset: now.getTimezoneOffset(), now: now }; diff --git a/src/js/util/parse-delimited-input.js b/src/js/util/parse-delimited-input.js index d33c67ab..90d89692 100644 --- a/src/js/util/parse-delimited-input.js +++ b/src/js/util/parse-delimited-input.js @@ -131,6 +131,7 @@ function cast_data(input, columnNames, stripCharsRegex, opts) { var index_types = unique(all_index_types); + /* Dead code, hasDate/isNumeric never used, and strict mode complains about assignment to undefined if(index_types.length !== 1 && !opts.type) { } @@ -138,6 +139,7 @@ function cast_data(input, columnNames, stripCharsRegex, opts) { hasDate = opts.type ? opts.type == "date" : index_types[0] === "date"; isNumeric = opts.type ? opts.type == "numeric" : index_types[0] === "number"; } + */ return { data: data, diff --git a/src/js/util/validate-data-input.js b/src/js/util/validate-data-input.js index 1a09d47c..ae769507 100644 --- a/src/js/util/validate-data-input.js +++ b/src/js/util/validate-data-input.js @@ -8,7 +8,7 @@ var some = require("lodash/some"); var unique = require("lodash/uniq"); var catchChartMistakes = require("./catch-chart-mistakes"); -types = { +let types = { "number": "numeric", "object": "date", "string": "ordinal" From 964627ab7963ddc44f3659b550e5f2bed5c5c796 Mon Sep 17 00:00:00 2001 From: jstray Date: Tue, 21 Feb 2017 21:18:27 -0500 Subject: [PATCH 2/5] Add var declarations to avoid assigning to undefined --- src/js/components/shared/DataInput.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/components/shared/DataInput.jsx b/src/js/components/shared/DataInput.jsx index 1af7d846..d3bcf56f 100644 --- a/src/js/components/shared/DataInput.jsx +++ b/src/js/components/shared/DataInput.jsx @@ -43,13 +43,13 @@ var DataInput = React.createClass({ _handleReparseUpdate: function(k, v) { if (k == "input") { - input = update(this.props.chartProps.input, { $merge: { + var input = update(this.props.chartProps.input, { $merge: { raw: v, type: undefined }}); ChartViewActions.updateInput(k, input); } else if (k == "type") { - input = update(this.props.chartProps.input, { $set: { + var input = update(this.props.chartProps.input, { $set: { raw: v.raw, type: v.type }}); From 84b2eeb0e64f3003d5623d0b1d876cf2c16093f8 Mon Sep 17 00:00:00 2001 From: jstray Date: Wed, 5 Apr 2017 15:44:25 -0400 Subject: [PATCH 3/5] filename should not be a global var --- src/js/components/ChartExport.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/components/ChartExport.jsx b/src/js/components/ChartExport.jsx index 52fa9343..8d3b4f50 100644 --- a/src/js/components/ChartExport.jsx +++ b/src/js/components/ChartExport.jsx @@ -101,7 +101,7 @@ var ChartExport = React.createClass({ }, downloadPNG: function() { - filename = this._makeFilename("png"); + var filename = this._makeFilename("png"); saveSvgAsPng.saveSvgAsPng(this.state.chartNode, filename, { scale: 2.0 }); }, From 0c898f14cdf72ee81d48e81f42023379257c08ba Mon Sep 17 00:00:00 2001 From: jstray Date: Fri, 14 Jul 2017 14:21:26 -0700 Subject: [PATCH 4/5] Add var for compilation under ES6 --- src/js/charts/cb-chart-grid/parse-chart-grid.js | 2 +- src/js/charts/cb-xy/parse-xy.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/charts/cb-chart-grid/parse-chart-grid.js b/src/js/charts/cb-chart-grid/parse-chart-grid.js index e24eba9f..a9a0b5e9 100644 --- a/src/js/charts/cb-chart-grid/parse-chart-grid.js +++ b/src/js/charts/cb-chart-grid/parse-chart-grid.js @@ -78,7 +78,7 @@ function parseChartgrid(config, _chartProps, callback, parseOpts) { var factor = Math.pow(10, maxPrecision); gridSettings.type = _chartProps._grid.type || "line"; - _computed = { + var _computed = { //TODO look at entries for all series not just the first data: bySeries.series[0].values.map(function(d){return +d.entry}), hasColumn: false, diff --git a/src/js/charts/cb-xy/parse-xy.js b/src/js/charts/cb-xy/parse-xy.js index ab1bbe58..5803fb8a 100644 --- a/src/js/charts/cb-xy/parse-xy.js +++ b/src/js/charts/cb-xy/parse-xy.js @@ -182,7 +182,7 @@ function parseXY(config, _chartProps, callback, parseOpts) { if (bySeries.isNumeric) { scale.isNumeric = bySeries.isNumeric; - _computed = { + var _computed = { //TODO look at entries for all series not just the first data: bySeries.series[0].values.map(function(d){return +d.entry}), hasColumn: false, From d900411af5c9cfcf1b004b074ae3e781c2624cdf Mon Sep 17 00:00:00 2001 From: jstray Date: Tue, 1 Aug 2017 11:44:38 -0700 Subject: [PATCH 5/5] Revert to proper timezone string --- src/js/stores/SessionStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/stores/SessionStore.js b/src/js/stores/SessionStore.js index a9efd595..71139caf 100644 --- a/src/js/stores/SessionStore.js +++ b/src/js/stores/SessionStore.js @@ -11,7 +11,7 @@ var _session = { emSize: 10, width: 640, timerOn: (localStorage.hasOwnProperty("model") === true), - nowOffset: now.getTimezoneOffset(), + nowOffset: getTZOffset(now), now: now };