Skip to content
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
29 changes: 13 additions & 16 deletions docs/assets/examples/en/area-chart/segment-range-area.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,13 @@ const spec = {
itemContent: {
type: 'text',
autoRotate: false,
text: {
style: {
text: 'BALANCE AGAINST',
style: {
fontSize: 14,
fontWeight: 'bold',
fill: 'rgba(0,0,0,0.45)',
textAlign: 'center',
textBaseline: 'middle'
}
fontSize: 14,
fontWeight: 'bold',
fill: 'rgba(0,0,0,0.45)',
textAlign: 'center',
textBaseline: 'middle'
}
},
itemLine: {
Expand All @@ -121,15 +119,14 @@ const spec = {
offsetX: -40,
type: 'text',
autoRotate: false,
text: {
style: {
text: ['BALANCE in', 'FAVOUR of ENGLAND'],
style: {
fontSize: 14,
fontWeight: 'bold',
fill: 'rgba(0,0,0,0.45)',
textAlign: 'left',
textBaseline: 'middle'
}

fontSize: 14,
fontWeight: 'bold',
fill: 'rgba(0,0,0,0.45)',
textAlign: 'left',
textBaseline: 'middle'
}
},
itemLine: {
Expand Down
10 changes: 5 additions & 5 deletions docs/assets/examples/en/bar-chart/bar-markPoint.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ const spec = {
type: 'text',
autoRotate: false,
text: {
dy: 14,
text: '2 mins',
style: {
fill: 'white',
fontSize: 14
},
labelBackground: {
padding: [5, 10, 5, 10],
style: {
fill: '#000',
cornerRadius: 5
}
}
},
style: {
dy: 14,
fill: 'white',
fontSize: 14
}
},
itemLine: {
Expand Down
160 changes: 80 additions & 80 deletions docs/assets/examples/en/marker/geo-mark-point.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,91 +17,91 @@ option: mapChart#markPoint
## Demo source

```javascript livedemo
const response1 = await fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/map-mark-point.json');
const dataJson = await response1.json();
const data = dataJson.features.map(d => d['properties'])
const minValue = Math.min(...data.map(d => d.scores))
const maxValue = Math.max(...data.map(d => d.scores))
const response1 = await fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/map-mark-point.json');
const dataJson = await response1.json();
const data = dataJson.features.map(d => d['properties']);
const minValue = Math.min(...data.map(d => d.scores));
const maxValue = Math.max(...data.map(d => d.scores));

const response2 = await fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/geojson/usa.json');
const geojson = await response2.json();
VChart.registerMap('usa', geojson);

const response2 = await fetch('https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/geojson/usa.json');
const geojson = await response2.json();
VChart.registerMap('usa', geojson);
function sizeScale(value, domain, range) {
const t = (value - domain[0]) / (domain[1] - domain[0]);
const newValue = (range[1] - range[0]) * t + range[0];
return newValue;
}

function sizeScale(value, domain, range) {
const t = (value - domain[0]) / (domain[1] - domain[0]);
const newValue = (range[1] - range[0]) * t + range[0];
return newValue;
const spec = {
type: 'map',
title: {
text: 'Opioid Overdose Rates (per 100,000) by Year: 2017'
},
color: {
type: 'linear',
range: ['rgb(252,250,97)', 'rgb(252,150,134)', 'rgb(87,33,15)']
},
area: {
style: {
fill: {
field: 'scores',
scale: 'color',
changeDomain: 'replace'
}
}

const spec = {
type: 'map',
title: {
text: 'Opioid Overdose Rates (per 100,000) by Year: 2017',
},
color: {
type: 'linear',
range: ['rgb(252,250,97)', 'rgb(252,150,134)', 'rgb(87,33,15)']
},
area: {
style: {
fill: {
field: 'scores',
scale: 'color',
changeDomain: 'replace'
}
}
},
data: [
{
values: data
}
],
nameField: 'name',
valueField: 'scores',
nameProperty: 'name',
map: 'usa',
region: [
{
roam: true,
projection: {
type: 'albersUsa'
}
}
],
legends: [
{
visible: true,
type: 'color',
field: 'scores',
orient: 'bottom',
position: 'start',
title: {
visible: true,
text: 'Population'
}
}
],
markPoint: data.map(d => {
return {
areaName: d.name,
itemLine: {
visible: false,
},
itemContent: {
type: 'symbol',
autoRotate: false,
offsetX: -10,
offsetY: -5,
symbolStyle: {
size: sizeScale(d.scores, [minValue, maxValue], [20, 40]),
fill: '#FF6347',
symbolType: '<svg t="1713712806835" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9361" width="200" height="200"><path d="M524.66 101.57H498c-116.06 0-210.15 94.09-210.15 210.15v383.44c0 123.23 100.25 223.48 223.48 223.48s223.48-100.25 223.48-223.48V311.72c0.01-116.06-94.08-210.15-210.15-210.15z m-40.72 28.86c8.09 0 14.65 6.56 14.65 14.65s-6.56 14.65-14.65 14.65-14.66-6.56-14.66-14.65 6.57-14.65 14.66-14.65zM325.23 279C352.8 156.23 437.3 142.24 440.88 141.7c7.25-1.07 14.07 3.92 15.16 11.22 1.08 7.26-3.9 14.02-11.14 15.15-3.09 0.51-70.32 12.86-93.65 116.78-1.39 6.2-6.89 10.41-12.99 10.41-0.97 0-1.95-0.1-2.94-0.33-7.19-1.61-11.71-8.74-10.09-15.93z m382.93 416.16c0 108.53-88.3 196.82-196.82 196.82s-196.82-88.3-196.82-196.82V514.82h393.64v180.34z" p-id="9362"></path></svg>'
}
}
}
})
},
data: [
{
values: data
}
],
nameField: 'name',
valueField: 'scores',
nameProperty: 'name',
map: 'usa',
region: [
{
roam: true,
projection: {
type: 'albersUsa'
}
}
],
legends: [
{
visible: true,
type: 'color',
field: 'scores',
orient: 'bottom',
position: 'start',
title: {
visible: true,
text: 'Population'
}
}
],
markPoint: data.map(d => {
return {
areaName: d.name,
itemLine: {
visible: false
},
itemContent: {
type: 'symbol',
autoRotate: false,
offsetX: -10,
offsetY: -5,
style: {
size: sizeScale(d.scores, [minValue, maxValue], [20, 40]),
fill: '#FF6347',
symbolType:
'<svg t="1713712806835" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9361" width="200" height="200"><path d="M524.66 101.57H498c-116.06 0-210.15 94.09-210.15 210.15v383.44c0 123.23 100.25 223.48 223.48 223.48s223.48-100.25 223.48-223.48V311.72c0.01-116.06-94.08-210.15-210.15-210.15z m-40.72 28.86c8.09 0 14.65 6.56 14.65 14.65s-6.56 14.65-14.65 14.65-14.66-6.56-14.66-14.65 6.57-14.65 14.66-14.65zM325.23 279C352.8 156.23 437.3 142.24 440.88 141.7c7.25-1.07 14.07 3.92 15.16 11.22 1.08 7.26-3.9 14.02-11.14 15.15-3.09 0.51-70.32 12.86-93.65 116.78-1.39 6.2-6.89 10.41-12.99 10.41-0.97 0-1.95-0.1-2.94-0.33-7.19-1.61-11.71-8.74-10.09-15.93z m382.93 416.16c0 108.53-88.3 196.82-196.82 196.82s-196.82-88.3-196.82-196.82V514.82h393.64v180.34z" p-id="9362"></path></svg>'
}
}
};
})
};
const vchart = new VChart(spec, { dom: CONTAINER_ID });
vchart.renderSync();

Expand Down
24 changes: 10 additions & 14 deletions docs/assets/examples/en/marker/mark-area-range.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,11 @@ const spec = {
offsetY: 0,
type: 'image',
autoRotate: false,
image: {
style: {
dx: -55,
width: 30,
height: 30,
image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/%E7%AE%AD%E5%A4%B4%20%E4%B8%8B%E9%99%8D.png'
}
style: {
dx: -55,
width: 30,
height: 30,
image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/%E7%AE%AD%E5%A4%B4%20%E4%B8%8B%E9%99%8D.png'
}
}
},
Expand All @@ -144,13 +142,11 @@ const spec = {
type: 'image',
offsetY: 0,
autoRotate: false,
image: {
style: {
dx: -50,
width: 30,
height: 30,
image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/%E4%B8%8A%E5%8D%87.png'
}
style: {
dx: -50,
width: 30,
height: 30,
image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/%E4%B8%8A%E5%8D%87.png'
}
}
}
Expand Down
26 changes: 11 additions & 15 deletions docs/assets/examples/en/marker/mark-area-with-label.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,11 @@ const spec = {
itemContent: {
type: 'image',
autoRotate: false,
image: {
style: {
dy: -6,
width: 30,
height: 30,
image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/%E7%AE%AD%E5%A4%B4%20%E4%B8%8B%E9%99%8D.png'
}
style: {
dy: -6,
width: 30,
height: 30,
image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/%E7%AE%AD%E5%A4%B4%20%E4%B8%8B%E9%99%8D.png'
}
}
},
Expand All @@ -238,14 +236,12 @@ const spec = {
itemContent: {
type: 'image',
autoRotate: false,
image: {
style: {
dy: -6,
dx: 8,
width: 30,
height: 30,
image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/%E4%B8%8A%E5%8D%87.png'
}
style: {
dy: -6,
dx: 8,
width: 30,
height: 30,
image: 'https://lf9-dp-fe-cms-tos.byteorg.com/obj/bit-cloud/%E4%B8%8A%E5%8D%87.png'
}
}
}
Expand Down
Loading
Loading