Skip to content

Commit

Permalink
chore: default options
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfu1 committed Nov 6, 2023
1 parent f9cea69 commit 2cc8310
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 13 deletions.
4 changes: 4 additions & 0 deletions packages/plots/src/core/plots/area/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export class Area extends Plot<AreaOptions> {
scale: {
y: { nice: true },
},
axis: {
y: { title: false },
x: { title: false },
},
interaction: {
tooltip: {
shared: true,
Expand Down
4 changes: 4 additions & 0 deletions packages/plots/src/core/plots/bar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ export class Bar extends Plot<BarOptions> {
scale: {
y: { nice: true },
},
axis: {
y: { title: false },
x: { title: false },
},
interaction: {
tooltip: {
shared: true,
Expand Down
16 changes: 10 additions & 6 deletions packages/plots/src/core/plots/box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,25 @@ export class Box extends Plot<BoxOptions> {
public type = 'box';

/**
* 获取 折线图 默认配置项
* 获取箱线图默认配置项
* 供外部使用
*/
static getDefaultOptions(): Partial<BoxOptions> {
return {
type: 'view',
children: [{ type: 'box' }],
axis: {
y: { title: false },
x: { title: false },
},
// 默认 tooltip
tooltip: {
items: [
{ name: "min", channel: "y" },
{ name: "q1", channel: "y1" },
{ name: "q2", channel: "y2" },
{ name: "q3", channel: "y3" },
{ name: "max", channel: "y4" },
{ name: 'min', channel: 'y' },
{ name: 'q1', channel: 'y1' },
{ name: 'q2', channel: 'y2' },
{ name: 'q3', channel: 'y3' },
{ name: 'max', channel: 'y4' },
],
},
};
Expand Down
5 changes: 0 additions & 5 deletions packages/plots/src/core/plots/bullet/adaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,6 @@ export function adaptor(params: Params) {
if (layout !== 'horizontal') {
const target = params.options.children[2];
target.shapeField = 'hyphen';
target.labels[0] = {
text: target.labels[0].text,
position: 'bottom',
dy: -5,
};
}

return params;
Expand Down
6 changes: 5 additions & 1 deletion packages/plots/src/core/plots/bullet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ export class Bullet extends Plot<BulletOptions> {
},
},
},
axis: {
y: { title: false },
x: { title: false },
},
children: [
{
type: 'interval',
style: { maxWidth: 30 },
axis: { y: { grid: true, gridLineWidth: 2 }, x: { title: false } },
axis: { y: { grid: true, gridLineWidth: 2 } },
},
{
type: 'interval',
Expand Down
4 changes: 4 additions & 0 deletions packages/plots/src/core/plots/column/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export class Column extends Plot<ColumnOptions> {
shared: true,
},
},
axis: {
y: { title: false },
x: { title: false },
},
children: [
{
type: 'interval',
Expand Down
8 changes: 7 additions & 1 deletion packages/plots/src/core/plots/dual-axes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ export class DualAxes extends Plot<DualAxesOptions> {
* 供外部使用
*/
static getDefaultOptions(): Partial<DualAxesOptions> {
return { type: 'view' };
return {
type: 'view',
axis: {
y: { title: false },
x: { title: false },
},
};
}

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/plots/src/core/plots/histogram/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export class Histogram extends Plot<HistogramOptions> {
return {
type: 'view',
autoFit: true,
axis: {
y: { title: false },
x: { title: false },
},
children: [
{
type: 'rect',
Expand Down
4 changes: 4 additions & 0 deletions packages/plots/src/core/plots/line/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export class Line extends Plot<LineOptions> {
shared: true,
},
},
axis: {
y: { title: false },
x: { title: false },
},
animate: {
enter: { type: 'growInX' },
},
Expand Down
7 changes: 7 additions & 0 deletions packages/plots/src/core/plots/scatter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ export class Scatter extends Plot<ScatterOptions> {
*/
static getDefaultOptions(): Partial<ScatterOptions> {
return {
axis: {
y: { title: false },
x: { title: false },
},
legend: {
size: false,
},
children: [{ type: 'point' }],
};
}
Expand Down

0 comments on commit 2cc8310

Please sign in to comment.