100","kind":"boolean","description":"`true` only if comment length is over `100`\\n"}],"description":"Length of the comment"}]},{"name":"countryIso","title":"Country ISO","formula":"$countryIsoCode","kind":"string"},{"name":"countryName","title":"Country Name","formula":"$countryName","kind":"string"},{"name":"deltaBucket100","title":"Delta Bucket","formula":"$deltaBucket100","kind":"number"},{"name":"isAnonymous","title":"Is Anonymous","formula":"$isAnonymous","kind":"boolean"},{"name":"isMinor","title":"Is Minor","formula":"$isMinor","kind":"boolean"},{"name":"isNew","title":"Is New","formula":"$isNew","kind":"boolean"},{"name":"isRobot","title":"Is Robot","formula":"$isRobot","kind":"boolean"},{"name":"isUnpatrolled","title":"Is Unpatrolled","formula":"$isUnpatrolled","kind":"string"},{"name":"metroCode","title":"Metro Code","formula":"$metroCode","kind":"string"},{"name":"namespace","title":"Namespace","formula":"$namespace","kind":"string"},{"name":"page","title":"Page","formula":"$page","kind":"string"},{"name":"regionIso","title":"Region ISO","formula":"$regionIsoCode","kind":"string"},{"name":"regionName","title":"Region Name","formula":"$regionName","kind":"string"},{"name":"user","title":"User","formula":"$user","kind":"string"},{"name":"userChars","title":"User Chars","formula":"$userChars","kind":"string"}],"measures":[{"name":"rowsAndDeltas","measures":[{"name":"count","title":"Rows","formula":"$main.count()"},{"name":"deltas","measures":[{"name":"delta","title":"Delta","formula":"$main.sum($delta)"},{"name":"avg_delta","title":"Avg Delta","formula":"$main.average($delta)"}],"title":"Deltas"}],"title":"Rows & Deltas"},{"name":"added","title":"Added","formula":"$main.sum($added)","description":"Sum of all additions\\n"},{"name":"avg_added","title":"Avg Added","formula":"$main.average($added)"},{"name":"deleted","title":"Deleted","formula":"$main.sum($deleted)","description":"Sum of all deletions\\n"},{"name":"avg_deleted","title":"Avg Deleted","formula":"$main.average($deleted)"},{"name":"unique_users","title":"Unique Users","formula":"$main.countDistinct($user)"}],"refreshRule":{"rule":"fixed","time":"2015-09-13T00:00:00.000Z"},"extendedDescription":"Contains data about Wikipedia editors and articles with information about edits, comments and article metadata\\n\\n*Based on wikiticker from 2015-09-12*\\n","defaultDuration":"P1D","defaultSortMeasure":"added","defaultSelectedMeasures":["added"],"defaultPinnedDimensions":["channel","namespace","isRobot"],"timeAttribute":"time","attributes":[{"name":"time","type":"TIME"},{"name":"channel","type":"STRING"},{"name":"cityName","type":"STRING"},{"name":"comment","type":"STRING"},{"name":"countryIsoCode","type":"STRING"},{"name":"countryName","type":"STRING"},{"name":"namespace","type":"STRING"},{"name":"page","type":"STRING"},{"name":"regionIsoCode","type":"STRING"},{"name":"regionName","type":"STRING"},{"name":"sometimeLater","type":"STRING"},{"name":"user","type":"STRING"},{"name":"userChars","type":"SET/STRING"},{"name":"isAnonymous","type":"BOOLEAN"},{"name":"isMinor","type":"BOOLEAN"},{"name":"isNew","type":"BOOLEAN"},{"name":"isRobot","type":"BOOLEAN"},{"name":"isUnpatrolled","type":"BOOLEAN"},{"name":"added","type":"NUMBER"},{"name":"commentLength","type":"NUMBER"},{"name":"deleted","type":"NUMBER"},{"name":"delta","type":"NUMBER"},{"name":"deltaBucket100","type":"NUMBER"},{"name":"deltaByTen","type":"NUMBER"},{"name":"metroCode","type":"NUMBER"}]}]},"timekeeper":{}}')
-if (!config || !config.version || !config.appSettings || !config.appSettings.dataCubes) {
+const config: Config = (window as any)["__CONFIG__"];
+if (!config) {
throw new Error("config not found");
}
-if (config.appSettings.customization.sentryDSN) {
- errorReporterInit(config.appSettings.customization.sentryDSN, config.version);
-}
-
const version = config.version;
Ajax.version = version;
-const appSettings = AppSettings.fromJS(config.appSettings, {
- executorFactory: Ajax.queryUrlExecutorFactory.bind(config)
-});
+const appSettings = deserializeAppSettings(config.appSettings);
-const app =
-
;
+if (config.appSettings.customization.sentryDSN) {
+ errorReporterInit(config.appSettings.customization.sentryDSN, config.version);
+}
-ReactDOM.render(app, container);
+const app =
;
-applyDragAndDropPolyfill();
+ReactDOM.render(app, container);
if (process.env.NODE_ENV === "dev-hmr" && module.hot) {
module.hot.accept();
diff --git a/client/app/components/TurniloComponent/client/modals/source-modal/highlighter.tsx b/client/app/components/TurniloComponent/client/modals/source-modal/highlighter.tsx
new file mode 100644
index 000000000..fa0625b93
--- /dev/null
+++ b/client/app/components/TurniloComponent/client/modals/source-modal/highlighter.tsx
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2017-2022 Allegro.pl
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import jsonLanguage from "highlight.js/lib/languages/json";
+import React from "react";
+/* Imported from `/src/` to save on bundle size.
+ * Luckily untranspiled source code is avaiable within npm package. */
+import SyntaxHighlighter from "react-syntax-highlighter/src/light";
+import githubGist from "react-syntax-highlighter/src/styles/hljs/github-gist";
+
+SyntaxHighlighter.registerLanguage("json", jsonLanguage);
+
+const Highlighter: React.FunctionComponent = ({ children: source }) =>
+
+ {source}
+ ;
+
+export default Highlighter;
diff --git a/client/app/components/TurniloComponent/client/modals/source-modal/source-modal.tsx b/client/app/components/TurniloComponent/client/modals/source-modal/source-modal.tsx
index 5e30e3dc5..94c5ba240 100644
--- a/client/app/components/TurniloComponent/client/modals/source-modal/source-modal.tsx
+++ b/client/app/components/TurniloComponent/client/modals/source-modal/source-modal.tsx
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2019 Allegro.pl
+ * Copyright 2017-2022 Allegro.pl
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,11 +14,10 @@
* limitations under the License.
*/
-import * as React from "react";
-import SyntaxHighlighter from "react-syntax-highlighter";
-import { githubGist } from "react-syntax-highlighter/styles/hljs";
+import React, { useCallback, useState } from "react";
import { Fn } from "../../../common/utils/general/general";
import { Button } from "../../components/button/button";
+import { Loader } from "../../components/loader/loader";
import { Modal } from "../../components/modal/modal";
import { SafeCopyToClipboard } from "../../components/safe-copy-to-clipboard/safe-copy-to-clipboard";
import { STRINGS } from "../../config/constants";
@@ -34,37 +33,32 @@ interface SourceModalProps {
source: string;
}
-interface SourceModalState {
- copied: boolean;
-}
-
-export class SourceModal extends React.Component
{
+export const SourceModal: React.FunctionComponent = ({ copyLabel = STRINGS.copyDefinition, onClose, source, title, className, header }) => {
+ const [copied, setCopied] = useState(false);
- state: SourceModalState = { copied: false };
+ const onCopy = useCallback(() => setCopied(true), [setCopied]);
- onCopy = () => this.setState({ copied: true });
+ const SyntaxHighlighter = React.lazy(() => import(/* webpackChunkName: "highlighter" */ "./highlighter"));
- render() {
- const { copyLabel = STRINGS.copyDefinition, onClose, source, title, className, header } = this.props;
-
- return
-
- {header}
-
+ return
+
+ {header}
+
+
{source}
-
-
-
-
-
- {this.state.copied &&
{STRINGS.copied}
}
-
+
+
+
+
+
+
+ {copied &&
{STRINGS.copied}
}
- ;
- }
-}
+
+ ;
+};
diff --git a/client/app/components/TurniloComponent/client/tsconfig.json b/client/app/components/TurniloComponent/client/tsconfig.json
index 23b56030f..05c709245 100644
--- a/client/app/components/TurniloComponent/client/tsconfig.json
+++ b/client/app/components/TurniloComponent/client/tsconfig.json
@@ -1,6 +1,5 @@
{
"extends": "../../../../tsconfig.json",
-
"compileOnSave": false,
"compilerOptions": {
"declaration": true,
@@ -9,8 +8,8 @@
"outDir": "../../build",
"experimentalDecorators": true
},
-
"include": [
+ "../../node_modules/highlight.js/types/index.d.ts",
"./**/*.ts",
"./**/*.tsx"
]
diff --git a/client/app/components/TurniloComponent/client/utils/dataset/selectors/dataset-fixtures.ts b/client/app/components/TurniloComponent/client/utils/dataset/selectors/dataset-fixtures.ts
index b6ff9bbdb..e080e384e 100644
--- a/client/app/components/TurniloComponent/client/utils/dataset/selectors/dataset-fixtures.ts
+++ b/client/app/components/TurniloComponent/client/utils/dataset/selectors/dataset-fixtures.ts
@@ -45,7 +45,7 @@ export const nominalDataset = makeDataset([{ channel: "foobar", [SPLIT]: nonNomi
export const sparseNominalDataset = makeDataset([{ channel: "foobar", [SPLIT]: sparseNonNominalDatums }]);
-export const scale = d3.time.scale().domain([january(1), january(7)]).range([0, 1000]) as unknown as ContinuousScale;
+export const scale = d3.scaleTime().domain([january(1), january(7)]).range([0, 1000]) as unknown as ContinuousScale;
export function createDailyNominalDatasetInJanuary(startDay: number, endDay: number): Dataset {
const datums = range(startDay, endDay).map(i => {
diff --git a/client/app/components/TurniloComponent/client/utils/dataset/selectors/selectors.ts b/client/app/components/TurniloComponent/client/utils/dataset/selectors/selectors.ts
index 0dc047403..12449f4b0 100644
--- a/client/app/components/TurniloComponent/client/utils/dataset/selectors/selectors.ts
+++ b/client/app/components/TurniloComponent/client/utils/dataset/selectors/selectors.ts
@@ -24,7 +24,7 @@ export const selectMainDatum = (dataset: Dataset): Datum =>
export const selectSplitDataset = (datum: Datum): Dataset =>
datum[SPLIT] as Dataset;
-const selectDatums = (dataset: Dataset): Datum[] =>
+export const selectDatums = (dataset: Dataset): Datum[] =>
dataset.data;
export const selectSplitDatums: (datum: Datum) => Datum[] =
diff --git a/client/app/components/TurniloComponent/client/utils/dataset/sparse-dataset/test-fixtures.ts b/client/app/components/TurniloComponent/client/utils/dataset/sparse-dataset/test-fixtures.ts
index 798067f11..36366998e 100644
--- a/client/app/components/TurniloComponent/client/utils/dataset/sparse-dataset/test-fixtures.ts
+++ b/client/app/components/TurniloComponent/client/utils/dataset/sparse-dataset/test-fixtures.ts
@@ -16,7 +16,6 @@
*/
import { Dataset } from "plywood";
-import { DataSetWithTabOptions } from "../../../views/cube-view/cube-view";
export const rawDataset = {
data: [
diff --git a/client/app/components/TurniloComponent/client/utils/drag-manager/drag-manager.ts b/client/app/components/TurniloComponent/client/utils/drag-manager/drag-manager.ts
index 19d790f5e..788ccc782 100644
--- a/client/app/components/TurniloComponent/client/utils/drag-manager/drag-manager.ts
+++ b/client/app/components/TurniloComponent/client/utils/drag-manager/drag-manager.ts
@@ -21,7 +21,7 @@ import { Measure } from "../../../common/models/measure/measure";
import { Series } from "../../../common/models/series/series";
import { Split } from "../../../common/models/split/split";
-enum DraggedElementType { NONE, DIMENSION, MEASURE, SERIES, SPLIT, FILTER }
+export enum DraggedElementType { NONE, DIMENSION, MEASURE, SERIES, SPLIT, FILTER }
interface DraggedElementBase {
type: DraggedElementType;
diff --git a/client/app/components/TurniloComponent/client/utils/function-slot/function-slot.ts b/client/app/components/TurniloComponent/client/utils/function-slot/function-slot.ts
index 1179a6d23..3d5bc3571 100644
--- a/client/app/components/TurniloComponent/client/utils/function-slot/function-slot.ts
+++ b/client/app/components/TurniloComponent/client/utils/function-slot/function-slot.ts
@@ -24,7 +24,7 @@ export interface FunctionSlot {
export function createFunctionSlot(): FunctionSlot {
var myFn: (...args: any[]) => T;
- var slot: FunctionSlot = (...args: any[]) => {
+ var slot: FunctionSlot = function(this: FunctionSlot, ...args: any[]) {
if (myFn) return myFn.apply(this, args);
return undefined;
};
diff --git a/client/app/components/TurniloComponent/client/utils/linear-scale/linear-scale.ts b/client/app/components/TurniloComponent/client/utils/linear-scale/linear-scale.ts
index 0baf71249..62f607c95 100644
--- a/client/app/components/TurniloComponent/client/utils/linear-scale/linear-scale.ts
+++ b/client/app/components/TurniloComponent/client/utils/linear-scale/linear-scale.ts
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-import { scale } from "d3";
+import * as d3 from "d3";
-export type LinearScale = scale.Linear;
+export type LinearScale = d3.ScaleLinear;
export const TICKS_COUNT = 5;
@@ -29,7 +29,7 @@ export default function getScale([min, max]: number[], height: number): LinearSc
return null;
}
- return scale.linear()
+ return d3.scaleLinear()
.domain([Math.min(min, 0), Math.max(max, 0)])
.nice(TICKS_COUNT)
.range([height, 0]);
diff --git a/client/app/components/TurniloComponent/client/utils/local-storage/local-storage.ts b/client/app/components/TurniloComponent/client/utils/local-storage/local-storage.ts
index 99dceed74..a9d096cf7 100644
--- a/client/app/components/TurniloComponent/client/utils/local-storage/local-storage.ts
+++ b/client/app/components/TurniloComponent/client/utils/local-storage/local-storage.ts
@@ -17,7 +17,7 @@
export function get(key: string): any {
try {
- return JSON.parse(localStorage[key]);
+ return JSON.parse(localStorage.getItem(key));
} catch (e) {
return undefined;
}
@@ -25,7 +25,14 @@ export function get(key: string): any {
export function set(key: string, value: any) {
try {
- localStorage[key] = JSON.stringify(value);
+ localStorage.setItem(key, JSON.stringify(value));
+ } catch (e) {
+ }
+}
+
+export function remove(key: string) {
+ try {
+ localStorage.removeItem(key);
} catch (e) {
}
}
diff --git a/client/app/components/TurniloComponent/client/utils/styles/_tech-mixins.scss b/client/app/components/TurniloComponent/client/utils/styles/_tech-mixins.scss
index c8ef24592..0cdebc0e4 100644
--- a/client/app/components/TurniloComponent/client/utils/styles/_tech-mixins.scss
+++ b/client/app/components/TurniloComponent/client/utils/styles/_tech-mixins.scss
@@ -111,9 +111,6 @@
@include internet-explorer {
overflow-x: visible;
}
- white-space: nowrap;
- overflow-x: hidden;
- text-overflow: ellipsis;
}
// for the shpitz
diff --git a/client/app/components/TurniloComponent/client/visualizations/bar-chart/bar-chart.tsx b/client/app/components/TurniloComponent/client/visualizations/bar-chart/bar-chart.tsx
index 85808c416..14696b985 100644
--- a/client/app/components/TurniloComponent/client/visualizations/bar-chart/bar-chart.tsx
+++ b/client/app/components/TurniloComponent/client/visualizations/bar-chart/bar-chart.tsx
@@ -21,7 +21,7 @@ import { Dataset, Datum, NumberRange, PlywoodRange, PseudoDatum, Range } from "p
import * as React from "react";
import { DateRange } from "../../../common/models/date-range/date-range";
import { Dimension } from "../../../common/models/dimension/dimension";
-import { FilterClause, FixedTimeFilterClause, NumberFilterClause, StringFilterAction, StringFilterClause } from "../../../common/models/filter-clause/filter-clause";
+import { BooleanFilterClause, FilterClause, FixedTimeFilterClause, NumberFilterClause, StringFilterAction, StringFilterClause } from "../../../common/models/filter-clause/filter-clause";
import { Measure } from "../../../common/models/measure/measure";
import { ConcreteSeries, SeriesDerivation } from "../../../common/models/series/concrete-series";
import { Series } from "../../../common/models/series/series";
@@ -87,6 +87,8 @@ function getFilterFromDatum(splits: Splits, dataPath: Datum[]): List {
let segmentValue = d[dimensionName];
const segmentStart = (segmentValue as PlywoodRange).start;
+ // @ts-ignore
while (i < segmentStart) {
filledData[j] = {};
filledData[j][dimensionName] = NumberRange.fromJS({
@@ -279,7 +282,7 @@ export class BarChart extends BaseVisualization {
return d3.extent(data, getY);
}
- getYScale(series: ConcreteSeries, yAxisStage: Stage): d3.scale.Linear {
+ getYScale(series: ConcreteSeries, yAxisStage: Stage): d3.ScaleLinear {
const { essence } = this.props;
const { flatData } = this.state;
@@ -288,7 +291,7 @@ export class BarChart extends BaseVisualization {
const extentY = this.getYExtent(leafData, series);
- return d3.scale.linear()
+ return d3.scaleLinear()
.domain([Math.min(extentY[0] * 1.1, 0), Math.max(extentY[1] * 1.1, 0)])
.range([yAxisStage.height, yAxisStage.y]);
}
@@ -302,7 +305,7 @@ export class BarChart extends BaseVisualization {
const xScale = this.getPrimaryXScale();
const { essence, stage } = this.props;
- const { stepWidth } = this.getBarDimensions(xScale.rangeBand());
+ const { stepWidth } = this.getBarDimensions(xScale.bandwidth());
const xTicks = xScale.domain();
const width = xTicks.length > 0 ? roundToPx(xScale(xTicks[xTicks.length - 1])) + stepWidth : 0;
@@ -619,7 +622,7 @@ export class BarChart extends BaseVisualization {
}
getYAxisStuff(dataset: Dataset, series: ConcreteSeries, chartStage: Stage, chartIndex: number): {
- yGridLines: JSX.Element, yAxis: JSX.Element, yScale: d3.scale.Linear
+ yGridLines: JSX.Element, yAxis: JSX.Element, yScale: d3.ScaleLinear
} {
const { yAxisStage } = this.getAxisStages(chartStage);
@@ -749,7 +752,7 @@ export class BarChart extends BaseVisualization {
}
}
- getPrimaryXScale(): d3.scale.Ordinal {
+ getPrimaryXScale(): d3.ScaleBand {
const { datasetLoad, maxNumberOfLeaves } = this.state;
if (!isLoaded(datasetLoad)) return null;
const data = (datasetLoad.dataset.data[0][SPLIT] as Dataset).data;
@@ -763,9 +766,9 @@ export class BarChart extends BaseVisualization {
const { usedWidth, padLeft } = this.getXValues(maxNumberOfLeaves);
- return d3.scale.ordinal()
+ return d3.scaleBand()
.domain(data.map(getX))
- .rangeBands([padLeft, padLeft + usedWidth]);
+ .range([padLeft, padLeft + usedWidth]);
}
getBarDimensions(xRangeBand: number): { stepWidth: number, barWidth: number, barOffset: number } {
@@ -799,7 +802,7 @@ export class BarChart extends BaseVisualization {
return { padLeft, usedWidth };
}
- getBarsCoordinates(chartIndex: number, xScale: d3.scale.Ordinal): BarCoordinates[] {
+ getBarsCoordinates(chartIndex: number, xScale: d3.ScaleBand): BarCoordinates[] {
if (!!this.coordinatesCache[chartIndex]) {
return this.coordinatesCache[chartIndex];
}
@@ -831,18 +834,18 @@ export class BarChart extends BaseVisualization {
}
getSubCoordinates(
- data: Datum[],
- series: ConcreteSeries,
- chartStage: Stage,
- getX: (d: Datum, i: number) => string,
- xScale: d3.scale.Ordinal,
- scaleY: d3.scale.Linear,
- splitIndex = 1
- ): BarCoordinates[] {
+ data: Datum[],
+ series: ConcreteSeries,
+ chartStage: Stage,
+ getX: (d: Datum, i: number) => string,
+ xScale: d3.ScaleBand,
+ scaleY: d3.ScaleLinear,
+ splitIndex = 1
+ ): BarCoordinates[] {
const { essence } = this.props;
const { maxNumberOfLeaves } = this.state;
- const { stepWidth, barWidth, barOffset } = this.getBarDimensions(xScale.rangeBand());
+ const { stepWidth, barWidth, barOffset } = this.getBarDimensions(xScale.bandwidth());
const coordinates: BarCoordinates[] = data.map((d, i) => {
let x = xScale(getX(d, i));
@@ -864,9 +867,9 @@ export class BarChart extends BaseVisualization {
let subStage: Stage = new Stage({ x, y: chartStage.y, width: barWidth, height: chartStage.height });
let subGetX: any = (d: Datum, i: number) => String(i);
let subData: Datum[] = (d[SPLIT] as Dataset).data;
- let subxScale = d3.scale.ordinal()
+ const subxScale = d3.scaleBand()
.domain(d3.range(0, maxNumberOfLeaves[splitIndex]).map(String))
- .rangeBands([x + barOffset, x + subStage.width]);
+ .range([x + barOffset, x + subStage.width]);
coordinate.children = this.getSubCoordinates(subData, series, subStage, subGetX, subxScale, scaleY, splitIndex + 1);
}
diff --git a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/bar-charts/bar-charts.tsx b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/bar-charts/bar-charts.tsx
index d857f95d3..e37ab8e09 100644
--- a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/bar-charts/bar-charts.tsx
+++ b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/bar-charts/bar-charts.tsx
@@ -34,7 +34,7 @@ interface BarChartsProps {
xScale: XScale;
}
-export const BarCharts: React.SFC = props => {
+export const BarCharts: React.FunctionComponent = props => {
const { dropHighlight, acceptHighlight, interaction, essence, dataset, xScale, scrollLeft, stage } = props;
const seriesList = essence.getConcreteSeries().toArray();
return
diff --git a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/bars/bar.tsx b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/bars/bar.tsx
index 33c8522bb..01573315f 100644
--- a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/bars/bar.tsx
+++ b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/bars/bar.tsx
@@ -39,7 +39,7 @@ const SingleBar: React.SFC = props => {
const { datum, xScale, yScale, getX, series, maxHeight } = props;
const x = getX(datum);
const xPos = xScale.calculate(x) + SIDE_PADDING;
- const width = xScale.rangeBand() - (2 * SIDE_PADDING);
+ const width = xScale.bandwidth() - (2 * SIDE_PADDING);
const y = series.selectValue(datum);
const yPos = yScale(y);
const height = maxHeight - yPos;
@@ -65,8 +65,8 @@ const TimeShiftBar: React.SFC = props => {
const { datum, xScale, yScale, getX, series, maxHeight } = props;
const x = getX(datum);
const xStart = xScale.calculate(x);
- const rangeBand = xScale.rangeBand();
- const fullWidth = rangeBand - 2 * SIDE_PADDING;
+ const bandwidth = xScale.bandwidth();
+ const fullWidth = bandwidth - 2 * SIDE_PADDING;
const barWidth = fullWidth * 2 / 3;
const yCurrent = series.selectValue(datum);
@@ -83,7 +83,7 @@ const TimeShiftBar: React.SFC = props => {
height={maxHeight - yCurrentStart} />
diff --git a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/foreground/highlight-modal.tsx b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/foreground/highlight-modal.tsx
index 6e155edd0..88d5a4b08 100644
--- a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/foreground/highlight-modal.tsx
+++ b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/foreground/highlight-modal.tsx
@@ -50,7 +50,7 @@ export const HighlightModal: React.SFC = props => {
series,
xScale } = props;
const xValue = getX(datum);
- const x = xScale.calculate(xValue) + (xScale.rangeBand() / 2);
+ const x = xScale.calculate(xValue) + (xScale.bandwidth() / 2);
const yValue = series.selectValue(datum);
const y = yScale(yValue);
return = props => {
const { stage, yScale, series, xScale, showPrevious, interaction: { datum }, getX } = props;
const xValue = getX(datum);
const left = xScale.calculate(xValue);
- const right = left + xScale.rangeBand();
+ const right = left + xScale.bandwidth();
const yValue = getYValue(datum, series, showPrevious);
const top = yScale(yValue) + stage.y - TOP_PADDING;
return ;
diff --git a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/foreground/hover-tooltip.tsx b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/foreground/hover-tooltip.tsx
index 2bdcec0d3..1c6ba616a 100644
--- a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/foreground/hover-tooltip.tsx
+++ b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/foreground/hover-tooltip.tsx
@@ -73,7 +73,7 @@ export const HoverTooltip: React.SFC = props => {
} = props;
const y = yScale(series.selectValue(datum));
const xValue = getX(datum);
- const x = xScale.calculate(xValue) + (xScale.rangeBand() / 2);
+ const x = xScale.calculate(xValue) + (xScale.bandwidth() / 2);
return {
});
it("should return range band", () => {
- expect(scale.rangeBand()).to.be.equal(30);
+ expect(scale.bandwidth()).to.be.equal(30);
});
it("should apply scale function", () => {
diff --git a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/utils/x-scale.ts b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/utils/x-scale.ts
index 9f625123d..63aa323ec 100644
--- a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/utils/x-scale.ts
+++ b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/utils/x-scale.ts
@@ -23,16 +23,17 @@ export interface XScale {
calculate(x: DomainValue): number;
invert(x: number): DomainValue;
domain(): XDomain;
- rangeBand(): number;
+ bandwidth(): number;
}
export function createXScale(domain: XDomain, width: number): XScale {
const range: [number, number] = [0, width];
const stringifiedDomain = domain.map(formatDomainValue);
- const ordinalScale = d3.scale.ordinal()
+ const ordinalScale = d3.scaleBand()
.domain(stringifiedDomain)
- .rangeRoundBands(range, 0, 0);
- const quantizedScale = d3.scale.quantize()
+ .rangeRound(range);
+
+ const quantizedScale = d3.scaleQuantize()
.domain(range)
.range(domain);
@@ -40,10 +41,11 @@ export function createXScale(domain: XDomain, width: number): XScale {
calculate: (value: DomainValue) => ordinalScale(formatDomainValue(value)),
domain: () => domain,
invert: (x: number) => quantizedScale(x),
- rangeBand: () => ordinalScale.rangeBand()
+ bandwidth: () => ordinalScale.bandwidth()
};
}
+
export const xGetter = (reference: string): Unary =>
datum => (datum[reference] as DomainValue);
diff --git a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/y-axis/y-axis.tsx b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/y-axis/y-axis.tsx
index 3f1d5275e..f14e38a31 100644
--- a/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/y-axis/y-axis.tsx
+++ b/client/app/components/TurniloComponent/client/visualizations/bar-chart/improved-bar-chart/y-axis/y-axis.tsx
@@ -15,7 +15,7 @@
*/
import * as d3 from "d3";
-import { Dataset } from "plywood";
+import { Dataset, Datum } from "plywood";
import * as React from "react";
import { Essence } from "../../../../../common/models/essence/essence";
import { Stage } from "../../../../../common/models/stage/stage";
@@ -37,7 +37,7 @@ export const YAxis: React.SFC = props => {
const axisStage = calculateYAxisStage(stage);
return
{seriesList.map(series => {
- const extent = d3.extent(datums, datum => series.selectValue(datum));
+ const extent = d3.extent(datums, (datum: Datum) => series.selectValue(datum));
const scale = getScale(extent, axisStage.height);
return
import memoizeOne from "memoize-one";
diff --git a/client/app/components/TurniloComponent/client/visualizations/heat-map/labeled-heatmap.tsx b/client/app/components/TurniloComponent/client/visualizations/heat-map/labeled-heatmap.tsx
index 98c8a444f..7920bc11f 100644
--- a/client/app/components/TurniloComponent/client/visualizations/heat-map/labeled-heatmap.tsx
+++ b/client/app/components/TurniloComponent/client/visualizations/heat-map/labeled-heatmap.tsx
@@ -18,13 +18,15 @@
import { Timezone } from "chronoshift";
import { List } from "immutable";
import { Datum } from "plywood";
-import * as React from "react";
+import React from "react";
import { Essence } from "../../../common/models/essence/essence";
import { FilterClause } from "../../../common/models/filter-clause/filter-clause";
import { Stage } from "../../../common/models/stage/stage";
import { formatSegment } from "../../../common/utils/formatter/formatter";
import { Unary } from "../../../common/utils/functional/functional";
import { Fn } from "../../../common/utils/general/general";
+import { ColorLegend } from "../../components/color-legend/color-legend";
+import { LegendSpot } from "../../components/pinboard-panel/pinboard-panel";
import { Scroller, ScrollerLayout, ScrollerPart } from "../../components/scroller/scroller";
import { clamp } from "../../utils/dom/dom";
import { LinearScale } from "../../utils/linear-scale/linear-scale";
@@ -191,6 +193,12 @@ export class LabelledHeatmap extends React.PureComponent}
}
/>
+
+
+
{highlightPosition && ;
+export type ColorScale = d3.ScaleLinear;
const white = "#fff";
const orange = "#ff5a00";
diff --git a/client/app/components/TurniloComponent/client/visualizations/line-chart/base-chart/foreground/hover-guide.tsx b/client/app/components/TurniloComponent/client/visualizations/line-chart/base-chart/foreground/hover-guide.tsx
index 39ec0aaef..9f137a1ae 100644
--- a/client/app/components/TurniloComponent/client/visualizations/line-chart/base-chart/foreground/hover-guide.tsx
+++ b/client/app/components/TurniloComponent/client/visualizations/line-chart/base-chart/foreground/hover-guide.tsx
@@ -23,7 +23,7 @@ import { ContinuousScale } from "../../utils/continuous-types";
interface HoverGuideProps {
hover: Hover;
stage: Stage;
- yScale: d3.scale.Linear;
+ yScale: d3.ScaleLinear;
xScale: ContinuousScale;
}
diff --git a/client/app/components/TurniloComponent/client/visualizations/line-chart/chart-line/chart-line.tsx b/client/app/components/TurniloComponent/client/visualizations/line-chart/chart-line/chart-line.tsx
index d50d9dc2a..d8a8de676 100644
--- a/client/app/components/TurniloComponent/client/visualizations/line-chart/chart-line/chart-line.tsx
+++ b/client/app/components/TurniloComponent/client/visualizations/line-chart/chart-line/chart-line.tsx
@@ -23,7 +23,7 @@ import { ContinuousRange, ContinuousScale } from "../utils/continuous-types";
import "./chart-line.scss";
import { prepareDataPoints } from "./prepare-data-points";
-export type Scale = d3.scale.Linear;
+export type Scale = d3.ScaleLinear;
export interface ChartLineProps {
xScale: ContinuousScale;
@@ -45,8 +45,8 @@ const stroke = (color: string, dashed: boolean): Pick = props => {
const { color, dashed, getX, getY, dataset, showArea, stage, xScale, yScale } = props;
- const area = d3.svg.area().y0(yScale(0));
- const line = d3.svg.line();
+ const area = d3.area().y0(yScale(0));
+ const line = d3.line();
const points = prepareDataPoints(dataset, getX, getY);
const scaledPoints = points.map(([x, y]) => [xScale(x), yScale(y)] as [number, number]);
diff --git a/client/app/components/TurniloComponent/client/visualizations/line-chart/utils/x-scale.ts b/client/app/components/TurniloComponent/client/visualizations/line-chart/utils/x-scale.ts
index 181114a95..3d33c9855 100644
--- a/client/app/components/TurniloComponent/client/visualizations/line-chart/utils/x-scale.ts
+++ b/client/app/components/TurniloComponent/client/visualizations/line-chart/utils/x-scale.ts
@@ -34,11 +34,11 @@ export function createContinuousScale(essence: Essence, domainRange: PlywoodRang
switch (kind) {
case "number": {
const domain = [domainRange.start, domainRange.end] as [number, number];
- return (d3.scale.linear().clamp(true) as unknown as ContinuousScale).domain(domain).range(range);
+ return (d3.scaleLinear().clamp(true) as unknown as ContinuousScale).domain(domain).range(range);
}
case "time": {
const domain = [domainRange.start, domainRange.end] as [Date, Date];
- return (d3.time.scale().clamp(true) as unknown as ContinuousScale).domain(domain).range(range);
+ return (d3.scaleTime().clamp(true) as unknown as ContinuousScale).domain(domain).range(range);
}
}
}
@@ -108,4 +108,4 @@ export function calculateXRange(essence: Essence, timekeeper: Timekeeper, datase
const filterRange = getFilterRange(essence, timekeeper);
const datasetRange = getDatasetXRange(dataset, continuousDimension);
return union(filterRange, datasetRange) as ContinuousRange;
-}
\ No newline at end of file
+}
diff --git a/client/app/components/TurniloComponent/client/visualizations/svg-icon/svg-icon.mocha.tsx b/client/app/components/TurniloComponent/client/visualizations/svg-icon/svg-icon.mocha.tsx
new file mode 100644
index 000000000..917f7397e
--- /dev/null
+++ b/client/app/components/TurniloComponent/client/visualizations/svg-icon/svg-icon.mocha.tsx
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2015-2016 Imply Data, Inc.
+ * Copyright 2017-2019 Allegro.pl
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { expect } from "chai";
+import React from "react";
+import * as ReactDOM from "react-dom/server";
+import "../../utils/test-utils";
+
+import { SvgIcon } from "./svg-icon";
+
+describe("SvgIcon", () => {
+ it("adds the correct class", () => {
+ expect(ReactDOM.renderToStaticMarkup(
+
+ )).to.equal(``);
+
+ const svg = ``;
+
+ expect(ReactDOM.renderToStaticMarkup(
+
+ )).to.equal(``);
+
+ // expect(TestUtils.isCompositeComponent(renderedComponent), 'should be composite').to.equal(true);
+ // expect(((ReactDOM.findDOMNode(renderedComponent) as Element).className, 'should contain class').to.contain('svg-icon');
+ });
+
+});
diff --git a/client/app/components/TurniloComponent/lib/style/_open-sans-600.scss b/client/app/components/TurniloComponent/client/visualizations/svg-icon/svg-icon.scss
similarity index 53%
rename from client/app/components/TurniloComponent/lib/style/_open-sans-600.scss
rename to client/app/components/TurniloComponent/client/visualizations/svg-icon/svg-icon.scss
index ddff2ccef..21a95c314 100644
--- a/client/app/components/TurniloComponent/lib/style/_open-sans-600.scss
+++ b/client/app/components/TurniloComponent/client/visualizations/svg-icon/svg-icon.scss
@@ -15,16 +15,8 @@
* limitations under the License.
*/
-@font-face {
- font-family: 'Open Sans';
- font-weight: 600;
- font-style: normal;
- src: url('/fonts/Open-Sans-600/Open-Sans-600.eot');
- src: url('/fonts/Open-Sans-600/Open-Sans-600.eot?#iefix') format('embedded-opentype'),
- local('Open Sans Semibold'),
- local('Open-Sans-600'),
- url('/fonts/Open-Sans-600/Open-Sans-600.woff2') format('woff2'),
- url('/fonts/Open-Sans-600/Open-Sans-600.woff') format('woff'),
- url('/fonts/Open-Sans-600/Open-Sans-600.ttf') format('truetype'),
- url('/fonts/Open-Sans-600/Open-Sans-600.svg#OpenSans') format('svg');
+@import '../../imports';
+
+.svg-icon {
+ pointer-events: none;
}
diff --git a/client/app/components/TurniloComponent/client/visualizations/svg-icon/svg-icon.tsx b/client/app/components/TurniloComponent/client/visualizations/svg-icon/svg-icon.tsx
new file mode 100644
index 000000000..04f23262b
--- /dev/null
+++ b/client/app/components/TurniloComponent/client/visualizations/svg-icon/svg-icon.tsx
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2015-2016 Imply Data, Inc.
+ * Copyright 2017-2019 Allegro.pl
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import React from "react";
+import "./svg-icon.scss";
+
+// Inspired by: https://gist.github.com/MoOx/1eb30eac43b2114de73a
+
+export interface SvgIconProps {
+ svg: string;
+ className?: string;
+ style?: any;
+}
+
+export interface SvgIconState {
+}
+
+export class SvgIcon extends React.Component {
+
+ render() {
+ const { className, style, svg } = this.props;
+
+ let viewBox: string = null;
+ let svgInsides: string = null;
+ if (typeof svg === "string") {
+ svgInsides = svg
+ .substr(0, svg.length - 6) // remove trailing ""
+ .replace(/^