-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3645 from VisActor/release/1.13.3
[Auto release] release 1.13.3
- Loading branch information
Showing
167 changed files
with
1,793 additions
and
1,527 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.13.2","mainProject":"@visactor/vchart","nextBump":"patch"}] | ||
[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.13.3","mainProject":"@visactor/vchart","nextBump":"patch"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
--- | ||
category: examples | ||
group: customMark | ||
title: pie extension icon | ||
order: 40-9 | ||
cover: /vchart/preview/pie-extension-icon.png | ||
option: pieChart#extensionMark | ||
--- | ||
|
||
# pie extension icon | ||
|
||
## Key option | ||
|
||
- `extensionMark` 属性配置自定义 polygon 图元 | ||
- `extensionMark.type` 属性配置图元的类型 | ||
- `extensionMark.dataId` 属性配置图元的数据来源 | ||
- `extensionMark.style` 属性配置图元的样式 | ||
|
||
## Demo source | ||
|
||
```javascript livedemo | ||
const iconMap = { | ||
Walk: '<svg t="1733989335784" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2434" width="200" height="200"><path d="M798.848 459.2l-124-45.92-78.048-142.336c-4.608-4.608-9.216-9.184-9.216-13.792l-9.184-9.184c-32.16-32.128-78.048-36.736-119.392-18.368L243.168 303.072c-18.368 4.576-32.128 22.944-36.736 41.312l-18.368 169.888c-4.576 27.552 18.368 55.104 45.92 59.712h4.608c27.552 0 50.528-18.368 50.528-45.92l13.76-133.184 82.656-27.552c-13.76 32.128-27.552 64.288-36.736 87.264-18.368 41.312-18.368 96.416 4.576 142.336L211.04 927.552c-13.76 32.128 0 73.472 32.128 87.232 13.792-4.576 22.976 0 32.16 0 27.552 0 50.496-13.76 59.68-41.312l105.6-238.784c64.288 114.784 137.76 247.968 137.76 252.544 13.76 22.976 36.736 36.736 59.712 36.736 9.184 0 22.944-4.608 32.128-9.184 32.16-18.368 45.92-59.68 27.552-91.84-4.576-9.184-114.784-215.808-188.256-339.808l64.256-142.336 22.976 41.312c4.576 13.76 18.368 18.368 27.552 22.976l142.336 55.104c4.608 0 13.76 4.576 18.368 4.576 22.944 0 41.312-13.76 50.528-36.736 4.576-27.552-9.184-59.712-36.736-68.896z m-220.416-257.152c55.104 0 101.024-45.92 101.024-101.024S633.536 0 578.432 0s-101.024 45.92-101.024 101.024 45.92 101.024 101.024 101.024z" p-id="2435"></path></svg>', | ||
Car: '<svg t="1733989365871" class="icon" viewBox="0 0 1260 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3445" width="200" height="200"><path d="M1075.28019535 354.04406738v34.34072647c-1.1408882 17.17036287-12.37863388 28.63628692-29.20673065 28.63628692H974.14048129c-1.1408882 1.1408882-1.1408882 2.28177568-2.2817764 3.42266389l6.73123929 3.42266313c43.86714022 42.3269417 67.48352051 93.83803176 66.34263232 155.67415695a1201.35498047 1201.35498047 0 0 1-7.87212676 109.86750715c-3.36561965 27.4383545-10.09685821 54.93375322-22.4754921 81.2312195-5.64739532 10.26799162-12.37863388 19.45213927-24.75726777 21.73391495-5.5903511 1.1408882-6.73123857 5.70443955-6.73123857 10.26799162v45.80664979c0 21.73391495-12.37863388 34.34072647-32.5723503 34.34072647h-52.82311095c-22.47549209 0-34.85412598-12.54976729-34.85412599-35.48161467v-36.62250214c-80.94599765 5.70443955-162.97583925 9.12710342-243.92183686 9.12710343-80.94599765 0-161.83495177-3.42266388-243.92183761-9.12710343v36.62250214c0 24.01569062-12.37863388 35.48161466-34.79708175 35.48161467h-52.88015518c-20.25076065 0-32.5723503-12.54976729-32.57235031-34.34072647v-45.74960556c0-5.70443955-1.1408882-9.12710342-6.73123855-10.26799163-12.37863388-2.3388199-19.10987245-10.32503585-24.75726777-21.79095917-13.46247713-25.15657882-19.10987245-52.65197754-22.4754921-81.2312195a1203.46562345 1203.46562345 0 0 1-7.87212676-109.86750715c0-61.83612519 22.47549209-113.34721525 66.34263303-155.67415695l6.73123857-3.42266313c-1.1408882-1.1408882-1.1408882-2.28177568-2.28177568-3.42266389H191.7765897c-17.96898497 0-29.20673066-11.40887909-29.20673138-28.63628692v-34.34072646a26.24042207 26.24042207 0 0 1 26.98199993-27.4383545h17.96898425c33.71323777 0 57.32961807 38.90427782 57.32961807 38.90427782 1.1408882 4.56355135 4.50650712 9.12710342 9.01301496 15.97243116 4.50650712-14.83154297 6.73123857-26.24042207 10.09685821-37.70634611a459.15034335 459.15034335 0 0 1 66.34263231-143.0673447c21.33460389-30.86101837 51.68222275-42.3269417 85.39546051-48.03138196C496.39366429 142.35231399 557.08890129 141.21142578 618.92502721 141.21142578c60.69523772 0 122.5313629 1.1408882 183.22659987 11.40887909 33.71323777 6.90237198 64.06085664 17.22740783 85.39546053 48.08842619a501.70546341 501.70546341 0 0 1 66.34263303 143.06734471c3.36561965 11.40887909 6.73123857 22.87480314 10.09685821 37.76339034 3.42266388-6.84532775 6.73123857-11.40887909 9.01301425-16.0294754 0 0 23.61638029-38.90427782 57.32961807-38.90427782h17.96898498c15.74425353 0 26.98199922 11.40887909 26.9819992 27.4383545z m-749.73449708 36.62250214l-3.36561962 10.32503585c97.77409513-7.98621522 196.68907775-12.54976729 294.52021711-12.5497673 97.77409513 0 195.54818955 3.42266388 294.46317215 12.5497673 0-2.28177568 0-6.84532775-1.1408882-10.26799161a523.26824492 523.26824492 0 0 0-61.77908096-156.81504443c-2.28177568-3.42266388-3.42266388-4.56355135-5.64739532-6.84532774a18.31125107 18.31125107 0 0 0-6.73123856-3.42266387c-17.96898497-8.04326017-71.9329834-24.07273485-218.08072588-25.21362305-146.09069825 1.1408882-200.05469667 17.11331865-218.02368163 25.15657882-2.28177568 0-4.56355135 2.28177568-6.7882828 3.42266387a30.23352967 30.23352967 0 0 0-5.59035109 6.90237197 606.15375215 606.15375215 0 0 0-61.8361252 156.7580002z m14.60336534 234.62360078c35.93796922 0 64.06085664-29.72013017 64.06085663-65.20174412s-29.20673066-65.25878906-64.06085663-65.25878905c-34.79708174 0-64.06085664 29.7771744-64.06085664 65.25878906 0 35.48161466 28.12288741 65.20174483 64.06085664 65.20174411z m556.41103896 0c35.93796922 0 64.06085664-29.72013017 64.06085664-65.20174412s-28.06584318-65.25878906-64.06085664-65.25878905c-34.79708174 0-64.06085664 29.7771744-64.06085662 65.25878906 0 35.48161466 28.06584318 65.20174483 64.06085662 65.20174411z" p-id="3446"></path></svg>', | ||
Bike: '<svg t="1733989388014" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4503" width="200" height="200"><path d="M794.24 545.6l-64-367.36A137.28 137.28 0 0 0 595.2 64h-75.52a64 64 0 0 0 0 128h75.52a9.6 9.6 0 0 1 9.6 8l28.48 164.8-259.84 181.76L300.8 416h19.2a64 64 0 0 0 0-128H96a64 64 0 0 0 0 128h58.24l72.32 130.24A224 224 0 1 0 448 651.52l210.24-147.2 10.88 64a224 224 0 1 0 126.08-22.08zM256 864a96 96 0 1 1 96-96 96 96 0 0 1-96 96z m512 0a96 96 0 1 1 96-96 96 96 0 0 1-96 96z" p-id="4504"></path></svg>', | ||
Bus: '<svg t="1733989407393" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5490" width="200" height="200"><path d="M292.534858 694.826287q0-30.271054-21.43933-51.710384t-51.710384-21.43933-51.710384 21.43933-21.43933 51.710384 21.43933 51.710384 51.710384 21.43933 51.710384-21.43933 21.43933-51.710384zM877.668573 694.826287q0-30.271054-21.43933-51.710384t-51.710384-21.43933-51.710384 21.43933-21.43933 51.710384 21.43933 51.710384 51.710384 21.43933 51.710384-21.43933 21.43933-51.710384zM851.365395 468.561357l-41.150714-219.417143q-2.847911-13.151589-12.863598-21.43933t-23.135277-8.287741l-524.559608 0q-13.151589 0-23.135277 8.287741t-12.863598 21.43933l-41.150714 219.417143q-2.847911 17.151464 7.99975 30.271054t27.999125 13.151589l606.829037 0q17.151464 0 27.999125-13.151589t7.99975-30.271054zM722.24943 118.844286q0-11.423643-7.99975-19.423393t-19.423393-7.99975l-365.716571 0q-11.423643 0-19.423393 7.99975t-7.99975 19.423393 7.99975 19.423393 19.423393 7.99975l365.716571 0q11.423643 0 19.423393-7.99975t7.99975-19.423393zM950.818287 533.13534l0 344.565232-73.149714 0 0 73.149714q0 30.271054-21.43933 51.710384t-51.710384 21.43933-51.710384-21.43933-21.43933-51.710384l0-73.149714-438.834286 0 0 73.149714q0 30.271054-21.43933 51.710384t-51.710384 21.43933-51.710384-21.43933-21.43933-51.710384l0-73.149714-73.149714 0 0-344.565232q0-63.998 14.271554-127.420018l58.846161-259.415893q5.151839-44.574607 55.710259-78.269554t131.419893-50.846411 178.55442-17.151464 178.55442 17.151464 131.419893 50.846411 55.710259 78.269554l59.998125 259.415893q13.151589 58.270179 13.151589 127.420018z" p-id="5491"></path></svg>' | ||
}; | ||
|
||
const spec = { | ||
type: 'pie', | ||
data: [ | ||
{ | ||
id: 'id0', | ||
values: [ | ||
{ | ||
Category: 'Bike', | ||
Value: 38 | ||
}, | ||
{ | ||
Category: 'Walk', | ||
Value: 32 | ||
}, | ||
{ | ||
Category: 'Car', | ||
Value: 18 | ||
}, | ||
{ | ||
Category: 'Bus', | ||
Value: 12 | ||
} | ||
] | ||
} | ||
], | ||
color: ['rgb(109, 182, 214)', 'rgb(68, 103, 168)', 'rgb(251, 220, 120)', 'rgb(239, 174, 117)', 'rgb(182, 78, 67)'], | ||
outerRadius: 0.8, | ||
valueField: 'Value', | ||
categoryField: 'Category', | ||
title: { | ||
visible: true, | ||
text: 'Statistics of Transportation' | ||
}, | ||
legends: { | ||
visible: true, | ||
orient: 'left' | ||
}, | ||
label: { | ||
visible: true | ||
}, | ||
tooltip: { | ||
mark: { | ||
content: [ | ||
{ | ||
key: datum => datum['type'], | ||
value: datum => datum['value'] + '%' | ||
} | ||
] | ||
} | ||
}, | ||
animation: false, | ||
extensionMark: [ | ||
{ | ||
name: 'marker', | ||
type: 'symbol', | ||
dataId: 'id0', | ||
style: { | ||
symbolType: (...params) => { | ||
return iconMap[params[0]['Category']]; | ||
}, | ||
fill: (...params) => { | ||
if (params[0]['Category'] === 'Car') { | ||
return 'rgb(22, 54, 129)'; | ||
} | ||
return 'white'; | ||
}, | ||
stroke: 'white', | ||
visible: true, | ||
x: (...params) => { | ||
const radius = (params[1].getLayoutRadius() / 2) * 0.8; | ||
const posX = | ||
Math.cos((params[1].startAngleScale(params[0]) + params[1].endAngleScale(params[0])) / 2) * radius; | ||
const offsetX = params[1].getCenter().x(); | ||
return posX + offsetX - 20; | ||
}, | ||
y: (...params) => { | ||
const radius = (params[1].getLayoutRadius() / 2) * 0.8; | ||
const posY = | ||
Math.sin((params[1].startAngleScale(params[0]) + params[1].endAngleScale(params[0])) / 2) * radius; | ||
const offsetY = params[1].getCenter().y(); | ||
return posY + offsetY - 20; | ||
}, | ||
size: 40 | ||
} | ||
} | ||
] | ||
}; | ||
const vchart = new VChart(spec, { dom: CONTAINER_ID }); | ||
vchart.renderSync(); | ||
|
||
// Just for the convenience of console debugging, DO NOT COPY! | ||
window['vchart'] = vchart; | ||
``` | ||
|
||
## Related Tutorials | ||
|
||
[Custom Mark](link) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.