Skip to content

Commit

Permalink
docs: 修改文档和优化demo (#1592)
Browse files Browse the repository at this point in the history
* docs: 修改文档和优化demo

* docs: 有遗漏补提
  • Loading branch information
arcsin1 authored Sep 17, 2020
1 parent a3ed5f4 commit f555606
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/common/shape-style.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

```ts
{
pointStyle: {
style: {
fill: 'red',
fillOpacity: 0.5,
stroke: 'black',
Expand Down
2 changes: 1 addition & 1 deletion docs/common/shape-style.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

```ts
{
pointStyle: {
style: {
fill: 'red',
fillOpacity: 0.5,
stroke: 'black',
Expand Down
11 changes: 11 additions & 0 deletions examples/bullet/basic/demo/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ const bulletPlot = new Bullet('container', {
rangeField: 'ranges',
targetField: 'target',
xField: 'title',
bulletStyle: {
range: {
color: '#5B8FF9',
},
measure: {
color: '#5B8FF9',
},
target: {
color: '#5B8FF9',
},
},
xAxis: {
line: null,
},
Expand Down
6 changes: 6 additions & 0 deletions examples/bullet/basic/demo/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ const bulletPlot = new Bullet('container', {
range: {
color: ['#FFB1AC', '#FFDBA2', '#B4EBBF'],
},
measure: {
color: '#5B8FF9',
},
target: {
color: '#5B8FF9',
},
},
xAxis: {
line: null,
Expand Down
23 changes: 12 additions & 11 deletions examples/bullet/basic/demo/grouped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@ const data = [
{
title: '重庆',
ranges: [30, 90, 120],
measures: [50, 40],
measures: [65],
target: 80,
},
{
title: '杭州',
ranges: [30, 90, 120],
measures: [50, 60],
measures: [50],
target: 100,
},
{
title: '广州',
ranges: [30, 90, 120],
measures: [40, 40],
measures: [40],
target: 85,
},
{
title: '深圳',
ranges: [30, 90, 120],
measures: [50, 60],
measures: [50],
target: 100,
},
];
Expand All @@ -37,6 +37,12 @@ const bulletPlot = new Bullet('container', {
range: {
color: ['#FFB1AC', '#FFDBA2', '#B4EBBF'],
},
measure: {
color: ['#5B8FF9'],
},
target: {
color: '#5B8FF9',
},
},
label: {
position: 'middle',
Expand Down Expand Up @@ -69,15 +75,10 @@ const bulletPlot = new Bullet('container', {
marker: { symbol: 'square', style: { fill: '#B4EBBF', r: 5 } },
},
{
value: '第一季度',
name: '第一季度',
value: '实际值',
name: '实际值',
marker: { symbol: 'square', style: { fill: '#5B8FF9', r: 5 } },
},
{
value: '第二季度',
name: '第二季度',
marker: { symbol: 'square', style: { fill: ' #5AD8A6', r: 5 } },
},
{
value: '目标值',
name: '目标值',
Expand Down
11 changes: 11 additions & 0 deletions examples/bullet/basic/demo/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ const bulletPlot = new Bullet('container', {
rangeField: 'ranges',
targetField: 'target',
xField: 'title',
bulletStyle: {
range: {
color: '#5B8FF9',
},
measure: {
color: '#5B8FF9',
},
target: {
color: '#5B8FF9',
},
},
xAxis: {
line: null,
},
Expand Down
2 changes: 1 addition & 1 deletion examples/bullet/basic/demo/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"zh": "基础垂直方向子弹图",
"en": "basic Bullet chart"
},
"screenshot": "https://gw.alipayobjects.com/mdn/rms_d314dd/afts/img/A*Vk43S5pvUJcAAAAAAAAAAABkARQnAQ"
"screenshot": "https://gw.alipayobjects.com/mdn/rms_d314dd/afts/img/A*BSeHR45zAxEAAAAAAAAAAAAAARQnAQ"
},
{
"filename": "color.ts",
Expand Down
6 changes: 6 additions & 0 deletions examples/bullet/basic/demo/stacked.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ const bulletPlot = new Bullet('container', {
range: {
color: ['#FFB1AC', '#FFDBA2', '#B4EBBF'],
},
measure: {
color: ['#5B8FF9', '#5AD8A6'],
},
target: {
color: '#5B8FF9',
},
},
label: {
position: 'middle',
Expand Down
2 changes: 1 addition & 1 deletion src/plots/bullet/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function transformData(options: BulletOptions): TransformData {
});
// 构建 title * target
ds.push({
index: 'target',
index: `${targetField}`,
[xField]: xField ? item[xField] : String(index),
[targetField]: item[targetField],
});
Expand Down

0 comments on commit f555606

Please sign in to comment.