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

feat: use @antv/vendor to replace d3 package #6594

Merged
merged 7 commits into from
Jan 23, 2025
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
7 changes: 4 additions & 3 deletions __tests__/plots/animation/aapl-area-keyframe.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

export async function aaplAreaKeyframe(): Promise<G2Spec> {
const data = await csv('data/aapl.csv', autoType);
const data = await csv<any>('data/aapl.csv', autoType);
const missing = data.map((d) => ({
...d,
close: d.date.getUTCMonth() <= 3 ? NaN : d.close,
Expand All @@ -24,6 +24,7 @@ export async function aaplAreaKeyframe(): Promise<G2Spec> {
connectFillOpacity: 0.15,
},
};
// @ts-ignore
return {
type: 'timingKeyframe',
width: 800,
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/animation/polio-point-stack-enter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { interpolateHcl } from 'd3-interpolate';
import { interpolateHcl } from '@antv/vendor/d3-interpolate';
import { G2Spec } from '../../../src';

/**
Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/animation/stocks-keyframe.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

const facetLine = (data) => ({
Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/interaction/gdp2-point-chart-fisheye.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec, PLOT_CLASS_NAME } from '../../../src';
import { step } from './utils';

Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/interaction/indices-line-brush-series.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec, PLOT_CLASS_NAME } from '../../../src';
import { brush } from './penguins-point-brush';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec, PLOT_CLASS_NAME } from '../../../src';
import { brush } from './penguins-point-brush';

Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/interaction/indices-line-chart-facet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec, PLOT_CLASS_NAME } from '../../../src';
import { step } from './utils';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec, ELEMENT_CLASS_NAME } from '../../../src';
import { step } from './utils';

Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/interaction/indices-line-crosshairs-xy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec, PLOT_CLASS_NAME } from '../../../src';
import { step } from './utils';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { regressionQuad } from 'd3-regression';
// @ts-ignore
import { regressionQuad } from '@antv/vendor/d3-regression';
import { G2Spec, PLOT_CLASS_NAME } from '../../../src';
import { points } from '../../data/points';
import { step } from './utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { regressionQuad } from 'd3-regression';
// @ts-ignore
import { regressionQuad } from '@antv/vendor/d3-regression';
import { G2Spec, PLOT_CLASS_NAME } from '../../../src';
import { points } from '../../data/points';
import { step } from './utils';
Expand Down
3 changes: 2 additions & 1 deletion __tests__/plots/interaction/points-point-regression-quad.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { regressionQuad } from 'd3-regression';
// @ts-ignore
import { regressionQuad } from '@antv/vendor/d3-regression';
import { G2Spec, PLOT_CLASS_NAME } from '../../../src';
import { points } from '../../data/points';
import { step } from './utils';
Expand Down
3 changes: 2 additions & 1 deletion __tests__/plots/interaction/points-point-tooltip-marker.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { regressionQuad } from 'd3-regression';
// @ts-ignore
import { regressionQuad } from '@antv/vendor/d3-regression';
import { G2Spec, PLOT_CLASS_NAME } from '../../../src';
import { points } from '../../data/points';
import { step } from './utils';
Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/interaction/unemployment-choropleth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { tsv } from 'd3-fetch';
import { tsv } from '@antv/vendor/d3-fetch';
import { feature } from 'topojson';
import { autoType } from 'd3-dsv';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec, ELEMENT_CLASS_NAME } from '../../../src';
import { step } from './utils';

Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/static/airports-point-choropleth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { csv } from 'd3-fetch';
import { csv } from '@antv/vendor/d3-fetch';
import { feature } from 'topojson';
import { autoType } from 'd3-dsv';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

export async function airportsPointChoropleth(): Promise<G2Spec> {
Expand Down
6 changes: 3 additions & 3 deletions __tests__/plots/static/barley-line-trail.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { rollup } from 'd3-array';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { rollup } from '@antv/vendor/d3-array';
import { G2Spec } from '../../../src';

export async function barleyLineTrail(): Promise<G2Spec> {
Expand Down
6 changes: 3 additions & 3 deletions __tests__/plots/static/barley-point-facet-rect-col-z-index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { groupSort, median } from 'd3-array';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { groupSort, median } from '@antv/vendor/d3-array';
import { G2Spec } from '../../../src';

export async function barleyPointFacetRectColZIndex(): Promise<G2Spec> {
Expand Down
6 changes: 3 additions & 3 deletions __tests__/plots/static/barley-point-facet-rect-col.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { groupSort, median } from 'd3-array';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { groupSort, median } from '@antv/vendor/d3-array';
import { G2Spec } from '../../../src';

export async function barleyPointFacetRectCol(): Promise<G2Spec> {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/cars2-point-jitterX.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as d3 from 'd3-random';
import * as d3 from '@antv/vendor/d3-random';
import { G2Spec } from '../../../src';

export function cars2PointJitterX(): G2Spec {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/cars2-point-jitterY.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as d3 from 'd3-random';
import * as d3 from '@antv/vendor/d3-random';
import { G2Spec } from '../../../src';

export function cars2PointJitterY(): G2Spec {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { feature } from 'topojson';
import { geoPolyconic, geoRectangularPolyconic } from 'd3-geo-projection';
import {
geoPolyconic,
geoRectangularPolyconic,
// @ts-ignore
} from '@antv/vendor/d3-geo-projection';
import { G2Spec } from '../../../src';

export async function countries50mProjectionComparison(): Promise<G2Spec> {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/diamond-point-jitter-polar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as d3 from 'd3-random';
import * as d3 from '@antv/vendor/d3-random';
import { G2Spec } from '../../../src';

export function diamondPointJitterPolar(): G2Spec {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/static/energy-sankey-custom-tooltip.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

export async function energySankeyCustomTooltip(): Promise<G2Spec> {
Expand Down
8 changes: 4 additions & 4 deletions __tests__/plots/static/energy-sankey-custom.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { schemeTableau10 } from 'd3-scale-chromatic';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { schemeTableau10 } from '@antv/vendor/d3-scale-chromatic';
import { G2Spec } from '../../../src';

export async function energySankeyCustom(): Promise<G2Spec> {
const links = await csv('data/energy.csv', autoType);
const links = await csv<any>('data/energy.csv', autoType);

const mockData = () => {
const LS = links.map((d) => d.source);
Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/static/energy-sankey-defaults.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

export async function energySankeyDefaults(): Promise<G2Spec> {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/static/energy-sankey-view-custom-tooltip.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

export async function energySankeyViewCustomTooltip(): Promise<G2Spec> {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/english-wordCloud.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { randomUniform, randomLcg } from 'd3-random';
import { randomUniform, randomLcg } from '@antv/vendor/d3-random';
import { G2Spec } from '../../../src';
import { text } from '../../data/txt-wordCloud';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { interpolateHcl } from 'd3-interpolate';
import { interpolateHcl } from '@antv/vendor/d3-interpolate';
import { G2Spec } from '../../../src';

export async function flarePointCirclePackCustomAutoPadding(): Promise<G2Spec> {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/flare-point-circle-pack-custom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { interpolateHcl } from 'd3-interpolate';
import { interpolateHcl } from '@antv/vendor/d3-interpolate';
import { G2Spec } from '../../../src';

export async function flarePointCirclePackCustom(): Promise<G2Spec> {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/flare-treemap-custom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { schemeTableau10 } from 'd3-scale-chromatic';
import { schemeTableau10 } from '@antv/vendor/d3-scale-chromatic';
import { G2Spec } from '../../../src';

export async function flareTreemapCustom(): Promise<G2Spec> {
Expand Down
6 changes: 3 additions & 3 deletions __tests__/plots/static/hale-choropleth-world.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { csv } from 'd3-fetch';
import { csv } from '@antv/vendor/d3-fetch';
import { feature, mesh } from 'topojson';
import { autoType } from 'd3-dsv';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

export async function haleChoroplethWorld(): Promise<G2Spec> {
const world = await fetch('data/countries-50m.json').then((res) =>
res.json(),
);
const hale = (await csv('data/hale.csv', autoType)).map((d) => ({
const hale = (await csv<any>('data/hale.csv', autoType)).map((d) => ({
...d,
hale: Number.isNaN(d.hale) ? d.hale : d.hale,
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { group } from 'd3-array';
import { group } from '@antv/vendor/d3-array';
import { incomeStatementByRegion } from '../../data/incomeStatementByRegion';

export function incomeStatementByRegionIntervalCustom() {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/static/indices-line-chart-facet-axis.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

export async function indicesLineChartFacetAxis(): Promise<G2Spec> {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/static/indices-line-point-scale-key.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

export async function indicesLinePointScaleKey(): Promise<G2Spec> {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/miserable-force-custom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { schemeTableau10 } from 'd3-scale-chromatic';
import { schemeTableau10 } from '@antv/vendor/d3-scale-chromatic';
import { G2Spec } from '../../../src';

export function miserableForceCustom(): G2Spec {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/month-interval-facet-circle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as d3 from 'd3-random';
import * as d3 from '@antv/vendor/d3-random';
import { G2Spec } from '../../../src';

export function monthIntervalFacetCircle(): G2Spec {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/month-interval-facet-rect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as d3 from 'd3-random';
import * as d3 from '@antv/vendor/d3-random';
import { G2Spec } from '../../../src';

export function monthIntervalFacetRect(): G2Spec {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/month-interval-radial-facet-rect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as d3 from 'd3-random';
import * as d3 from '@antv/vendor/d3-random';
import { G2Spec } from '../../../src';

export function monthIntervalRadialFacetRect(): G2Spec {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/philosophy-wordCloud-custom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { randomUniform, randomLcg } from 'd3-random';
import { randomUniform, randomLcg } from '@antv/vendor/d3-random';
import { G2Spec } from '../../../src';

export function philosophyWordCloudCustom(): G2Spec {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/philosophy-wordCloud-default.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { randomUniform, randomLcg } from 'd3-random';
import { randomUniform, randomLcg } from '@antv/vendor/d3-random';
import { G2Spec } from '../../../src';

export function philosophyWordCloudDefault(): G2Spec {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/philosophy-wordCloud-image.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { randomUniform, randomLcg } from 'd3-random';
import { randomUniform, randomLcg } from '@antv/vendor/d3-random';
import { G2Spec } from '../../../src';

export function philosophyWordCloudImage(): G2Spec {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/plots/static/premier-league-table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { median } from 'd3-array';
import { median } from '@antv/vendor/d3-array';
import { G2Spec } from '../../../src';

const logos = {
Expand Down
6 changes: 3 additions & 3 deletions __tests__/plots/static/temperature2-line-threshold.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { median } from 'd3-array';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { median } from '@antv/vendor/d3-array';
import { G2Spec } from '../../../src';

export async function temperature2LineThreshold(): Promise<G2Spec> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

export async function tranLineMultiAxesAutoPaddingTickMethod(): Promise<G2Spec> {
const data = await csv('data/train.csv', autoType);
const data = await csv<any>('data/train.csv', autoType);
const distanceName = new Map(data.map((d) => [d.distance, d.name]));
const xAxis = {
tickMethod: () => Array.from(distanceName.keys()),
Expand Down
11 changes: 8 additions & 3 deletions __tests__/plots/static/train-line-multi-axes.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { csv } from 'd3-fetch';
import { autoType } from 'd3-dsv';
import { csv } from '@antv/vendor/d3-fetch';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

interface Row {
distance: number;
name: string;
}

export async function tranLineMultiAxes(): Promise<G2Spec> {
const data = await csv('data/train.csv', autoType);
const data = await csv<Row>('data/train.csv', autoType);
const distanceName = new Map(data.map((d) => [d.distance, d.name]));
const xAxis = {
tickMethod: () => Array.from(distanceName.keys()),
Expand Down
4 changes: 2 additions & 2 deletions __tests__/plots/static/unemployment-choropleth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { tsv } from 'd3-fetch';
import { tsv } from '@antv/vendor/d3-fetch';
import { feature } from 'topojson';
import { autoType } from 'd3-dsv';
import { autoType } from '@antv/vendor/d3-dsv';
import { G2Spec } from '../../../src';

export async function unemploymentChoropleth(): Promise<G2Spec> {
Expand Down
Loading
Loading