-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(line): meta config -> scale (#1286)
* feat(line): meta config -> scale * build: remove gitee sync because repo is to large * feat(line): legend, tooltip, meta, axis options * feat(line): add axis option, minLimit, maxLimit, nice, tickMethod
- Loading branch information
Showing
9 changed files
with
178 additions
and
102 deletions.
There are no files selected for viewing
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,28 +1,28 @@ | ||
name: 🤖 Sync to Gitee Mirror | ||
# name: 🤖 Sync to Gitee Mirror | ||
|
||
on: [push] | ||
# on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🔁 Sync to Gitee | ||
uses: wearerequired/git-mirror-action@master | ||
env: | ||
# 注意在 Settings->Secrets 配置 GITEE_RSA_PRIVATE_KEY | ||
SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} | ||
with: | ||
# 注意替换为你的 GitHub 源仓库地址 | ||
source-repo: '[email protected]:antvis/G2Plot.git' | ||
# 注意替换为你的 Gitee 目标仓库地址 | ||
destination-repo: '[email protected]:antv-g2plot/antv-g2plot.git' | ||
# jobs: | ||
# build: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: 🔁 Sync to Gitee | ||
# uses: wearerequired/git-mirror-action@master | ||
# env: | ||
# # 注意在 Settings->Secrets 配置 GITEE_RSA_PRIVATE_KEY | ||
# SSH_PRIVATE_KEY: ${{ secrets.GITEE_RSA_PRIVATE_KEY }} | ||
# with: | ||
# # 注意替换为你的 GitHub 源仓库地址 | ||
# source-repo: '[email protected]:antvis/G2Plot.git' | ||
# # 注意替换为你的 Gitee 目标仓库地址 | ||
# destination-repo: '[email protected]:antv-g2plot/antv-g2plot.git' | ||
|
||
- name: ✅ Build Gitee Pages | ||
uses: yanglbme/gitee-pages-action@master | ||
with: | ||
# 注意替换为你的 Gitee 用户名 | ||
gitee-username: afc163 | ||
# 注意在 Settings->Secrets 配置 GITEE_PASSWORD | ||
gitee-password: ${{ secrets.GITEE_PASSWORD }} | ||
# 注意替换为你的 Gitee 仓库 | ||
gitee-repo: antv-g2plot/antv-g2plot | ||
# - name: ✅ Build Gitee Pages | ||
# uses: yanglbme/gitee-pages-action@master | ||
# with: | ||
# # 注意替换为你的 Gitee 用户名 | ||
# gitee-username: afc163 | ||
# # 注意在 Settings->Secrets 配置 GITEE_PASSWORD | ||
# gitee-password: ${{ secrets.GITEE_PASSWORD }} | ||
# # 注意替换为你的 Gitee 仓库 | ||
# gitee-repo: antv-g2plot/antv-g2plot |
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,5 +1,4 @@ | ||
stats.json | ||
.cache | ||
dist | ||
public | ||
demos/assets | ||
.umi |
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,52 @@ | ||
import { Line } from '../../../../src'; | ||
import { partySupport } from '../../../data/party-support'; | ||
import { createDiv } from '../../../utils/dom'; | ||
|
||
describe('line', () => { | ||
it('x*y*color and axis options', () => { | ||
const line = new Line(createDiv(), { | ||
width: 400, | ||
height: 300, | ||
data: partySupport.filter((o) => ['FF', 'Lab'].includes(o.type)), | ||
xField: 'date', | ||
yField: 'value', | ||
seriesField: 'type', | ||
color: ['blue', 'red'], | ||
appendPadding: 10, | ||
connectNulls: true, | ||
meta: { | ||
value: { | ||
min: 0, | ||
max: 5000, | ||
}, | ||
}, | ||
xAxis: { | ||
label: { | ||
style: { | ||
fill: 'red', | ||
}, | ||
}, | ||
}, | ||
yAxis: { | ||
tickCount: 3, | ||
min: 500, | ||
}, | ||
}); | ||
|
||
line.render(); | ||
|
||
const geometry = line.chart.geometries[0]; | ||
const elements = geometry.elements; | ||
// @ts-ignore | ||
expect(geometry.connectNulls).toBe(true); | ||
expect(elements.length).toBe(2); | ||
expect(elements[0].getModel().color).toBe('blue'); | ||
expect(elements[1].getModel().color).toBe('red'); | ||
|
||
expect(geometry.scales.value.min).toBe(500); | ||
expect(geometry.scales.value.max).toBe(5000); | ||
|
||
// @ts-ignore | ||
expect(line.chart.options.axes.date.label.style.fill).toBe('red'); | ||
}); | ||
}); |
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,13 @@ | ||
import { pick } from '../../../src/utils'; | ||
|
||
describe('pick', () => { | ||
it('pick', () => { | ||
expect(pick(null, [])).toEqual({}); | ||
expect(pick(undefined, [])).toEqual({}); | ||
expect(pick(1, [])).toEqual({}); | ||
|
||
expect(pick({ a: 1, b: 2, c: undefined }, ['a'])).toEqual({ a: 1 }); | ||
expect(pick({ a: 1, b: 2, c: undefined }, ['a', 'd'])).toEqual({ a: 1 }); | ||
expect(pick({ a: 1, b: 2, c: undefined }, ['a', 'c', 'd'])).toEqual({ a: 1 }); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
export { flow } from './flow'; | ||
export { pick } from './pick'; |
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,18 @@ | ||
/** | ||
* 类似 lodash.pick 的方法 | ||
* @param obj | ||
* @param keys | ||
*/ | ||
export function pick(obj: any, keys: string[]): object { | ||
const r = {}; | ||
|
||
if (obj !== null && typeof obj === 'object') { | ||
keys.forEach((key: string) => { | ||
const v = obj[key]; | ||
if (v !== undefined) { | ||
r[key] = v; | ||
} | ||
}); | ||
} | ||
return r; | ||
} |