Skip to content

Commit

Permalink
fix: site bug (#1696)
Browse files Browse the repository at this point in the history
Co-authored-by: xuying.xu <xuying.xu@alibaba-inc.com>
  • Loading branch information
tangying1027 and xuying.xu committed Jan 3, 2023
1 parent 736aee0 commit 3ecc390
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 66 deletions.
17 changes: 1 addition & 16 deletions site/.dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default defineConfig({
showChartResize: true, // 是否在 demo 页展示图表视图切换
showAPIDoc: true, // 是否在 demo 页展示API文档
versions: {
[version]: 'https://f2.antv.antgroup.com',
'4.x': 'https://f2.antv.vision',
'3.x': 'https://f2-v3.antv.vision',
},
Expand Down Expand Up @@ -306,14 +307,6 @@ export default defineConfig({
en: 'Funnel Charts',
},
},
{
slug: 'candlestick',
icon: 'candlestick',
title: {
zh: '蜡烛图',
en: 'Candlestick Charts',
},
},
{
slug: 'relation',
icon: 'relation',
Expand All @@ -322,14 +315,6 @@ export default defineConfig({
en: 'Relation Charts',
},
},
{
slug: 'heatmap',
icon: 'heatmap',
title: {
zh: '热力图',
en: 'Heatmap Charts',
},
},
{
slug: 'component',
icon: 'component',
Expand Down
17 changes: 10 additions & 7 deletions site/examples/column/column/demo/pattern.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,27 @@ const data = [
},
];

const img = new Image();
img.src = 'https://gw.alipayobjects.com/zos/rmsportal/cNOctfQVgZmwaXeBITuD.jpg';

img.onload = function () {
const context = document.getElementById('container').getContext('2d');
const pattern = context.createPattern(img, 'repeat');

const { props } = (
<Canvas context={context}>
<Chart data={data}>
<Axis field="year" />
<Axis field="sales" />
<Interval x="year" y="sales" color={{ range: [pattern] }} />
<Interval x="year" y="sales"
color={{
range: [
{
image: 'https://gw.alipayobjects.com/zos/rmsportal/cNOctfQVgZmwaXeBITuD.jpg',
repetition: 'repeat',
},
],
}}/>
</Chart>
</Canvas>
);

const canvas = new Canvas(props);

canvas.render();
};

4 changes: 2 additions & 2 deletions site/examples/component/guide/demo/custom.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Guide = withGuide((props) => {
return (
<group>
<text
attrs={{
style={{
x,
y,
text: '文本',
Expand All @@ -32,7 +32,7 @@ const Guide = withGuide((props) => {
}}
/>
<rect
attrs={{
style={{
x,
y,
width: Math.abs(end.x - start.x),
Expand Down
3 changes: 2 additions & 1 deletion site/examples/component/legend/demo/custom.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const Legend = withLegend((props) => {
return (
<group
style={{
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
Expand All @@ -28,7 +29,7 @@ const Legend = withLegend((props) => {
data-item={item}
>
<text
attrs={{
style={{
fill: color,
text: name,
}}
Expand Down
6 changes: 3 additions & 3 deletions site/examples/component/shape/demo/shape.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Shape = () => {
return (
<group>
<rect
attrs={{
style={{
x: 10,
y: 10,
width: 40,
Expand All @@ -17,9 +17,9 @@ const Shape = () => {
fill: 'red',
}}
/>
<circle attrs={{ x: 80, y: 30, r: 20, lineWidth: '2px', stroke: '#000', fill: 'red' }} />
<circle style={{ cx: 80, cy: 30, r: 20, lineWidth: '2px', stroke: '#000', fill: 'red' }} />
<text
attrs={{
style={{
x: 120,
y: 30,
text: '文本',
Expand Down
26 changes: 13 additions & 13 deletions site/examples/creative/case/demo/apple-watch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ const Shell = (props, context) => {

// 背景组件
const ArcGuideGroup = (props) => {
const { attrs } = props;
const { style } = props;
const { data, centerX, centerY, rUnit } = props;
return (
<group>
{data.map((record, index) => {
return (
<arc
key={'arc_' + index}
attrs={{
...attrs,
style={{
...style,
x: centerX,
y: centerY,
r: rUnit * (1 * index + 1),
Expand All @@ -106,15 +106,15 @@ const ArcGuideGroup = (props) => {

// 弧线组件
const RoundArcGroup = (props) => {
const { data, centerX, centerY, rUnit, attrs, animation } = props;
const { data, centerX, centerY, rUnit, style, animation } = props;
return (
<group>
{data.map((record, index) => {
return (
<arc
key={'record_' + index}
attrs={{
...attrs,
style={{
...style,
x: centerX,
y: centerY,
r: (1 * index + 1) * rUnit,
Expand All @@ -132,17 +132,17 @@ const RoundArcGroup = (props) => {

// icon组件
const ImgGuideGroup = (props) => {
const { data, centerX, centerY, rUnit, attrs } = props;
const { width, height } = attrs;
const { data, centerX, centerY, rUnit, style } = props;
const { width, height } = style;
return (
<group>
{data.map((record, index) => {
return (
<image
cacheImage
key={'img_' + index}
attrs={{
...attrs,
style={{
...style,
width,
height,
x: centerX - width / 2,
Expand All @@ -165,13 +165,13 @@ const { props } = (
return (
<Shell key={'shell_' + iter} context={context} data={records}>
<ArcGuideGroup
attrs={{
style={{
lineWidth: bgArcWidth,
opacity: 0.9,
}}
/>
<RoundArcGroup
attrs={{
style={{
lineWidth: arcWidth,
lineCap: 'round',
shadowColor: 'rgba(0,0,0,0.8)',
Expand All @@ -193,7 +193,7 @@ const { props } = (
}}
/>
<ImgGuideGroup
attrs={{
style={{
width: 16,
height: 16,
}}
Expand Down
2 changes: 1 addition & 1 deletion site/examples/creative/case/demo/line-race.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function EndView(props) {
}}
>
<text
attrs={{
style={{
fill: '#808080',
fontSize: '24px',
text: `${origin.emoji}${origin.country}`,
Expand Down
2 changes: 1 addition & 1 deletion site/examples/creative/case/demo/race-country.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function Year(props) {
return (
<group>
<text
attrs={{
style={{
x: right,
y: bottom,
text: year,
Expand Down
26 changes: 13 additions & 13 deletions site/examples/other/area/demo/custom-gauge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ const Gauge = withGauge((props) => {
return (
<group>
<arc
attrs={{
x,
y,
style={{
cx:x,
cy:y,
r,
startAngle,
endAngle,
startAngle: `${startAngle} rad`,
endAngle: `${endAngle} rad`,
lineWidth: '20px',
lineCap: 'round',
stroke: '#e7e7e7',
}}
/>
<arc
attrs={{
x,
y,
style={{
cx:x,
cy:y,
r,
startAngle,
endAngle: startAngle,
startAngle: `${startAngle} rad`,
endAngle: `${startAngle} rad `,
lineWidth: '60px',
lineCap: 'round',
stroke: '#0075ff',
Expand All @@ -38,10 +38,10 @@ const Gauge = withGauge((props) => {
duration: 500,
property: ['endAngle'],
start: {
endAngle: startAngle,
endAngle: `${startAngle} rad`,
},
end: {
endAngle: startAngle + diff * percent,
endAngle: `${startAngle + diff * percent} rad `,
},
},
}}
Expand All @@ -50,7 +50,7 @@ const Gauge = withGauge((props) => {
const { start, end } = tick;
return (
<line
attrs={{
style={{
x1: start.x,
y1: start.y,
x2: end.x,
Expand Down
7 changes: 4 additions & 3 deletions site/examples/pie/donut/demo/donut.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,22 @@ const Text = (props, context) => {
return (
<group
style={{
display: 'flex',
left: center.x,
top: center.y - context.px2hd('30px'),
width: '100px',
}}
>
<text
attrs={{
style={{
text: '总资产',
fill: '#000',
textAlign: 'center',
}}
/>
<text
style={{ marginTop: '10px' }}
attrs={{
style={{
marginTop: '10px',
text: '100.33亿元',
fill: '#000',
textAlign: 'center',
Expand Down
7 changes: 4 additions & 3 deletions site/examples/pie/donut/demo/double-donut.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,22 @@ const Text = (props, context) => {
return (
<group
style={{
display: 'flex',
left: center.x,
top: center.y - context.px2hd('30px'),
width: '100px',
}}
>
<text
attrs={{
style={{
text: '总资产',
fill: '#000',
textAlign: 'center',
}}
/>
<text
style={{ marginTop: '10px' }}
attrs={{
style={{
marginTop: '10px',
text: '100.33亿元',
fill: '#000',
textAlign: 'center',
Expand Down
4 changes: 2 additions & 2 deletions site/examples/pie/pie/demo/labelline-pie.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ const { props } = (
/>
<PieLabel
sidePadding={40}
label1={(data, color) => {
label1={(data, record) => {
return {
text: data.name,
fill: color,
fill: record.color,
};
}}
label2={(data) => {
Expand Down
2 changes: 1 addition & 1 deletion site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"scripts": {
"site:build": "dumi build",
"site:clean": "",
"site:deploy": "npm run site:build && gh-pages -d public",
"site:deploy": "gh-pages -d dist",
"site:develop": "dumi dev",
"site:start": "npm run site:develop"
},
Expand Down

0 comments on commit 3ecc390

Please sign in to comment.