Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vx replaced with visx #1010

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ If you want to go straight to rendering a legend, check if `ColorSwabs` or `Colo

_[Example code for scatterplot](https://github.com/allegro/turnilo/pull/834/files)_

Currently Turnilo supports adding tooltips to visualizations in two ways (please disregard the `TooltipWithBounds` approach from the `@vx/tooltip` package). You will probably want to use `TooltipWithinStage`, where you can pass `stage` and the position to render the tooltip. Use `SegmentBubbleContent` to render content, like so:
Currently Turnilo supports adding tooltips to visualizations in two ways (please disregard the `TooltipWithBounds` approach from the `@visx/tooltip` package). You will probably want to use `TooltipWithinStage`, where you can pass `stage` and the position to render the tooltip. Use `SegmentBubbleContent` to render content, like so:

```
<TooltipWithinStage left={leftPostion} top={topPosition} stage={stage}>
Expand Down
330 changes: 225 additions & 105 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@
},
"dependencies": {
"@sentry/browser": "5.0.6",
"@vx/heatmap": "0.0.183",
"@vx/scale": "0.0.182",
"@vx/tooltip": "0.0.184",
"@visx/heatmap": "1.0.0",
"@visx/scale": "1.0.0",
"@visx/tooltip": "1.0.0",
"axios": "0.21.2",
"body-parser": "1.18.2",
"chronoshift": "0.9.6",
Expand Down
55 changes: 0 additions & 55 deletions src/client/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,61 +14,6 @@
* limitations under the License.
*/

declare module "@vx/*";

declare module "@vx/heatmap" {

import { ColorScale, LinearScale } from "./visualizations/heat-map/utils/scales";

interface Bin {
width: number;
height: number;
x: number;
y: number;
color: string;
opacity: number;
row: number;
column: number;
}

export interface HeatmapRectProps {
bins(rawDataPoint: any): any;
count(rawDataPoint: any): number;
data: any[];
xScale: LinearScale;
yScale: LinearScale;
colorScale: ColorScale;
binWidth: number;
binHeight: number;
gap: number;
children?: (heatmap: Bin[][]) => React.ReactNode;
}

export class HeatmapRect extends React.Component<HeatmapRectProps> {

}
}

declare module "@vx/scale" {

interface ScaleLinearOptions<Range, Output> {
range: [Range, Range];
domain: [number, number];
}

export const scaleLinear: <Range = number, Output = number>(options: ScaleLinearOptions<Range, Output>) => d3.ScaleLinear<Range, Output>;
}

declare module "@vx/tooltip" {
interface TooltipWithBoundsProps {
key: number | string;
top: number;
left: number;
children: React.ReactNode;
}
const TooltipWithBounds: React.ComponentType<TooltipWithBoundsProps>;
}

declare module "react-syntax-highlighter/src/light" {
export { default } from "react-syntax-highlighter/dist/esm/light";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { TooltipWithBounds } from "@vx/tooltip";
import { TooltipWithBounds } from "@visx/tooltip";
import { Datum } from "plywood";
import React from "react";
import { Essence } from "../../../common/models/essence/essence";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
* limitations under the License.
*/

import { Bin } from "@vx/heatmap";
import { RectCell } from "@visx/heatmap/lib/heatmaps/HeatmapRect";
import { Datum } from "plywood";
import React from "react";

interface HeatMapRectangleRowProps {
bins: Bin[];
bins: Array<RectCell<Datum, Datum>>;
}

export class HeatMapRectangleRow extends React.PureComponent<HeatMapRectangleRowProps> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

import { HeatmapRect } from "@vx/heatmap";
import { HeatmapRect } from "@visx/heatmap";
import { Dataset, Datum } from "plywood";
import React from "react";
import { ConcreteSeries } from "../../../common/models/series/concrete-series";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { scaleLinear } from "@vx/scale";
import { scaleLinear } from "@visx/scale";
import { expect } from "chai";
import getHoverPosition from "./get-hover-position";

Expand Down
4 changes: 2 additions & 2 deletions src/client/visualizations/heat-map/utils/scales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { scaleLinear } from "@vx/scale";
import { scaleLinear } from "@visx/scale";
import * as d3 from "d3";
import { Datum } from "plywood";
import { ConcreteSeries } from "../../../../common/models/series/concrete-series";
Expand Down Expand Up @@ -58,7 +58,7 @@ export default function scales(dataset: Datum[], tileSize: number, mainColor: st
const colorMin = d3.min(dataset, d => d3.min(nestedDataset(d), select));
const colorMax = d3.max(dataset, d => d3.max(nestedDataset(d), select));

const color = scaleLinear<string, string>({
const color = scaleLinear<string>({
range: [white, mainColor],
domain: [Math.min(colorMin, 0), colorMax]
});
Expand Down