Skip to content

Commit

Permalink
docs: examples review
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfu1 committed Nov 21, 2023
1 parent aa7a762 commit 354875b
Show file tree
Hide file tree
Showing 61 changed files with 328 additions and 389 deletions.
7 changes: 6 additions & 1 deletion packages/plots/src/core/plots/area/type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import type { Options } from '../../types/common';

export type AreaOptions = Options;
export type AreaOptions = Omit<Options, 'yField'> & {
/**
* @title y轴字段
*/
readonly yField?: string | string[];
};
2 changes: 1 addition & 1 deletion packages/plots/src/core/plots/dual-axes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class DualAxes extends Plot<DualAxesOptions> {
return {
type: 'view',
axis: {
y: { title: false },
y: { title: false, tick: false },
x: { title: false },
},
};
Expand Down
4 changes: 2 additions & 2 deletions site/.dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default defineConfig({
title: 'Ant Design Charts',
description: 'AntV react component library',
defaultLanguage: 'zh',
siteUrl: 'https://charts.ant.design',
siteUrl: 'https://ant-design-charts.antgroup.com',
showChinaMirror: false,
footerTheme: 'light', // 白色 底部主题
githubUrl: repository.url,
Expand Down Expand Up @@ -127,7 +127,7 @@ export default defineConfig({
},
],
detail: {
engine:{
engine: {
zh: 'AntV react',
en: 'AntV react',
},
Expand Down
2 changes: 1 addition & 1 deletion site/examples/statistics/area/demo/area-difference.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const DemoArea = () => {
colorField: 'city',
shapeField: 'hvh',
diff: true,
meta: {
scale: {
color: { range: ['#67a9cf', '#ef8a62'] },
},
line: {
Expand Down
3 changes: 0 additions & 3 deletions site/examples/statistics/area/demo/orderly-area.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ const DemoArea = () => {
yField: 'unemployed',
colorField: 'industry',
shapeField: 'smooth',
meta: {
x: { utc: true },
},
axis: {
x: { title: 'Date' },
y: { labelFormatter: '~s' },
Expand Down
2 changes: 1 addition & 1 deletion site/examples/statistics/area/demo/range-spline-area.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const DemoArea = () => {
axis: {
y: { title: false },
},
meta: {
scale: {
x: { type: 'linear', tickCount: 10 },
},
point: {
Expand Down
30 changes: 15 additions & 15 deletions site/examples/statistics/box/demo/box-tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ import { Box } from '@ant-design/plots';

const DemoBox = () => {
const data = [
{ x: 'Oceania', y: [ 1, 9, 16, 22, 24 ]},
{ x: 'East Europe', y: [ 1, 5, 8, 12, 16 ]},
{ x: 'Australia', y: [ 1, 8, 12, 19, 26 ]},
{ x: 'South America', y: [ 2, 8, 12, 21, 28 ]},
{ x: 'North Africa', y: [ 1, 8, 14, 18, 24 ]},
{ x: 'North America', y: [ 3, 10, 17, 28, 30 ]},
{ x: 'West Europe', y: [ 1, 7, 10, 17, 22 ]},
{ x: 'West Africa', y: [ 1, 6, 8, 13, 16 ]},
{ x: 'Oceania', y: [1, 9, 16, 22, 24] },
{ x: 'East Europe', y: [1, 5, 8, 12, 16] },
{ x: 'Australia', y: [1, 8, 12, 19, 26] },
{ x: 'South America', y: [2, 8, 12, 21, 28] },
{ x: 'North Africa', y: [1, 8, 14, 18, 24] },
{ x: 'North America', y: [3, 10, 17, 28, 30] },
{ x: 'West Europe', y: [1, 7, 10, 17, 22] },
{ x: 'West Africa', y: [1, 6, 8, 13, 16] },
];

const config = {
data: {
value: data,
value: data,
},
xField: 'x',
yField: 'y',
meta: { x: { paddingInner: 0.6, paddingOuter: 0.3 }, y: { zero: true } },
scale: { x: { paddingInner: 0.6, paddingOuter: 0.3 }, y: { zero: true } },
tooltip: {
items: [
{ name: "最低值", channel: "y" },
{ name: "下四分位数", channel: "y1" },
{ name: "最低值", channel: "y2" },
{ name: "上四分位数", channel: "y3" },
{ name: "最高值", channel: "y4" },
{ name: '最低值', channel: 'y' },
{ name: '下四分位数', channel: 'y1' },
{ name: '最低值', channel: 'y2' },
{ name: '上四分位数', channel: 'y3' },
{ name: '最高值', channel: 'y4' },
],
},
};
Expand Down
18 changes: 9 additions & 9 deletions site/examples/statistics/box/demo/box.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { Box } from '@ant-design/plots';

const DemoBox = () => {
const data = [
{ x: 'Oceania', y: [ 1, 9, 16, 22, 24 ]},
{ x: 'East Europe', y: [ 1, 5, 8, 12, 16 ]},
{ x: 'Australia', y: [ 1, 8, 12, 19, 26 ]},
{ x: 'South America', y: [ 2, 8, 12, 21, 28 ]},
{ x: 'North Africa', y: [ 1, 8, 14, 18, 24 ]},
{ x: 'North America', y: [ 3, 10, 17, 28, 30 ]},
{ x: 'West Europe', y: [ 1, 7, 10, 17, 22 ]},
{ x: 'West Africa', y: [ 1, 6, 8, 13, 16 ]},
{ x: 'Oceania', y: [1, 9, 16, 22, 24] },
{ x: 'East Europe', y: [1, 5, 8, 12, 16] },
{ x: 'Australia', y: [1, 8, 12, 19, 26] },
{ x: 'South America', y: [2, 8, 12, 21, 28] },
{ x: 'North Africa', y: [1, 8, 14, 18, 24] },
{ x: 'North America', y: [3, 10, 17, 28, 30] },
{ x: 'West Europe', y: [1, 7, 10, 17, 22] },
{ x: 'West Africa', y: [1, 6, 8, 13, 16] },
];

const config = {
Expand All @@ -27,7 +27,7 @@ const DemoBox = () => {
style: {
stroke: 'black',
},
meta: {
scale: {
x: { paddingInner: 0.6, paddingOuter: 0.3 },
y: { zero: true },
},
Expand Down
2 changes: 1 addition & 1 deletion site/examples/statistics/box/demo/grouped-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const DemoBox = () => {
style: {
stroke: 'black',
},
meta: {
scale: {
x: { paddingInner: 0.2, paddingOuter: 0.1 },
y: { zero: true },
series: { paddingInner: 0.3, paddingOuter: 0.1 },
Expand Down
6 changes: 3 additions & 3 deletions site/examples/statistics/box/demo/polar-box.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const DemoBox = () => {
xField: 'x',
yField: 'y',
colorField: 'x',
meta: { x: { paddingInner: 0.6, paddingOuter: 0.3 }, y: { zero: true } },
coordinate: { type: "polar", innerRadius: 0.2 },
style: { stroke: "black" },
scale: { x: { paddingInner: 0.6, paddingOuter: 0.3 }, y: { zero: true } },
coordinate: { type: 'polar', innerRadius: 0.2 },
style: { stroke: 'black' },
axis: { y: { tickCount: 5 } },
legend: false,
};
Expand Down
2 changes: 1 addition & 1 deletion site/examples/statistics/column/demo/column-maxwidth.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const DemoColumn = () => {
data: [{ letter: 'A', frequency: 120 }],
xField: 'letter',
yField: 'frequency',
meta: {
scale: {
x: { padding: 0.5 },
},
style: {
Expand Down
2 changes: 1 addition & 1 deletion site/examples/statistics/column/demo/region-annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const DemoColumn = () => {
data,
xField: 'month',
yField: 'value',
meta: {
scale: {
y: {
domainMax: 2000,
domainMin: -1000,
Expand Down
18 changes: 2 additions & 16 deletions site/examples/statistics/dual-axes/demo/basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ const DemoDualAxes = () => {
type: 'interval',
xField: 'time',
yField: 'waiting',
axis: {
y: { title: 'Waiting', style: { titleFill: '#5B8FF9' } },
},
label: {
text: 'waiting',
position: 'inside',
},
},
{
type: 'line',
Expand All @@ -35,22 +28,15 @@ const DemoDualAxes = () => {
stroke: '#fdae6b',
lineWidth: 2,
},
label: {
text: 'people',
},
meta: {
scale: {
y: {
independent: true,
},
},
axis: {
y: {
position: 'right',
grid: null,
title: 'People',
style: {
titleFill: '#fdae6b',
},
// grid: null,
},
},
},
Expand Down
3 changes: 1 addition & 2 deletions site/examples/statistics/dual-axes/demo/column-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const DemoDualAxes = () => {
const config = {
data,
xField: 'time',
axis: { y: { title: null } },
children: [
{
type: 'interval',
Expand All @@ -28,7 +27,7 @@ const DemoDualAxes = () => {
stroke: '#5AD8A6',
lineWidth: 2,
},
meta: { y: { independent: true } },
scale: { y: { independent: true } },
axis: { y: { position: 'right' } },
},
],
Expand Down
6 changes: 3 additions & 3 deletions site/examples/statistics/dual-axes/demo/column-multi-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import ReactDOM from 'react-dom';
const lineColor = {
a: 'rgb(90, 216, 166)',
b: 'rgb(93, 112, 146)',
c: 'rgb(246, 189, 22)'
}
c: 'rgb(246, 189, 22)',
};

const DemoDualAxes = () => {
const uvData = [
Expand Down Expand Up @@ -54,7 +54,7 @@ const DemoDualAxes = () => {
lineWidth: 2,
stroke: (d) => lineColor[d[0].name],
},
meta: { y: { independent: true } },
scale: { y: { independent: true } },
axis: { y: { position: 'right' } },
},
],
Expand Down
9 changes: 4 additions & 5 deletions site/examples/statistics/dual-axes/demo/custom-column-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const DemoDualAxes = () => {
const config = {
data,
xField: 'time',
axis: { y: { title: null } },
children: [
{
type: 'interval',
Expand All @@ -23,7 +22,7 @@ const DemoDualAxes = () => {
label: { position: 'inside' },
interaction: {
elementHighlight: true,
elementHighlightByColor: { background: true }
elementHighlightByColor: { background: true },
},
},
{
Expand All @@ -34,14 +33,14 @@ const DemoDualAxes = () => {
stroke: '#5AD8A6',
lineWidth: 2,
},
meta: { y: { independent: true } },
scale: { y: { independent: true } },
axis: { y: { position: 'right' } },
interaction: {
tooltip: {
crosshairs: false,
marker: false,
}
}
},
},
},
],
annotations: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const DemoDualAxes = () => {
textAnchor: 'middle',
},
},
meta: {
scale: {
y: { independent: true },
},
axis: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { DualAxes } from '@ant-design/plots';
import React from 'react';
import ReactDOM from 'react-dom';
Expand Down Expand Up @@ -43,7 +42,7 @@ const DemoDualAxes = () => {
style: { maxWidth: 50 },
label: { position: 'inside' },
scale: { color: { range: ['#5B8FF9', '#5D7092'] } },
interaction: { elementHighlightByColor: { background: true, } },
interaction: { elementHighlightByColor: { background: true } },
},
{
data: transformData,
Expand All @@ -53,14 +52,14 @@ const DemoDualAxes = () => {
stroke: '#5AD8A6',
lineWidth: 2,
},
meta: { y: { independent: true } },
scale: { y: { independent: true } },
axis: { y: { position: 'right' } },
interaction: {
tooltip: {
crosshairs: false,
marker: false,
}
}
},
},
},
],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ const DemoDualAxes = () => {
color: {
itemMarker: 'round',
itemMarkerSize: 14,
position: 'right'
position: 'right',
},
},
axis: { y: { title: null } },
children: [
{
data: uvBillData,
Expand All @@ -43,10 +42,10 @@ const DemoDualAxes = () => {
colorField: 'type',
style: { maxWidth: 80 },
label: { position: 'inside' },
meta: { y: { domainMax: 1200 } },
scale: { y: { domainMax: 1200 } },
interaction: {
elementHighlight: true,
elementHighlightByColor: { background: true }
elementHighlightByColor: { background: true },
},
},
{
Expand All @@ -55,14 +54,14 @@ const DemoDualAxes = () => {
yField: 'count',
colorField: () => 'count',
style: { lineWidth: 2 },
meta: { y: { independent: true } },
scale: { y: { independent: true } },
axis: { y: { position: 'right' } },
interaction: {
tooltip: {
crosshairs: false,
marker: false,
}
}
},
},
},
],
theme: { category10: ['#F4A49E', '#FACDAA', '#EE7B91', '#E85285', '#BE408C', '#BE408C'] },
Expand Down
Loading

0 comments on commit 354875b

Please sign in to comment.