zz-chart
Advanced tools
Comparing version 0.1.0-beta.37 to 0.1.0-beta.38
@@ -27,3 +27,3 @@ import { isBoolean, isObject, merge, set } from 'lodash'; | ||
}; | ||
const { width, height, chartEle, ele, options, data, theme, chartOption, defaultInteractions, } = props; | ||
const { width, height, chartEle, ele, options, data, theme, chartOption, padding, defaultInteractions, } = props; | ||
this.reactivity = reactive(chartOption, this); | ||
@@ -33,3 +33,3 @@ this.chartContainer = chartEle; | ||
if (options) { | ||
this.options = options; | ||
this.options = { ...options, padding }; | ||
} | ||
@@ -36,0 +36,0 @@ data && this.data(data); |
@@ -1,2 +0,1 @@ | ||
/// <reference types="web" /> | ||
import uPlot from 'uplot'; | ||
@@ -3,0 +2,0 @@ import { Shape } from './index.js'; |
@@ -45,2 +45,5 @@ import { isObject, merge } from 'lodash'; | ||
console.log(names, value, prevValue); | ||
if (names.includes('data') && names.length === 1) { | ||
this.ctrl.data(value); | ||
} | ||
if (names.includes('options') && names.length > 1) { | ||
@@ -47,0 +50,0 @@ const [_, componentName] = names; |
import { axesSpace } from './utils.js'; | ||
export declare const AXES_X_VALUES: (string | number)[][]; | ||
export declare const UPLOT_DEFAULT_OPTIONS: { | ||
padding: number[]; | ||
legend: { | ||
@@ -5,0 +6,0 @@ show: boolean; |
@@ -17,2 +17,3 @@ import { axesSpace } from './utils.js'; | ||
export const UPLOT_DEFAULT_OPTIONS = { | ||
padding: [0, 0, 0, 0], | ||
legend: { | ||
@@ -64,3 +65,3 @@ show: false, | ||
points: { | ||
show: false | ||
show: false, | ||
}, | ||
@@ -67,0 +68,0 @@ drag: { |
@@ -25,3 +25,3 @@ import UPlot from 'uplot'; | ||
export declare class UPlotViewStrategy extends ViewStrategy { | ||
shapes: ("area" | "line" | "bar" | "point")[]; | ||
shapes: ("line" | "area" | "bar" | "point")[]; | ||
qt: Quadtree; | ||
@@ -28,0 +28,0 @@ get name(): string; |
@@ -24,2 +24,3 @@ import { merge, mergeWith, omit } from 'lodash'; | ||
const { width, height } = this.ctrl.size; | ||
const ctrlOption = this.ctrl.getOption(); | ||
const series = this.getSeries(); | ||
@@ -38,2 +39,3 @@ const theme = this.getThemeOption(); | ||
...UPLOT_DEFAULT_OPTIONS, | ||
...(ctrlOption.padding ? { padding: ctrlOption.padding } : {}), | ||
plugins, | ||
@@ -143,5 +145,5 @@ // fmtDate: () => UPlot.fmtDate('{HH}:{mm}'), | ||
changeSize(size) { | ||
// TODO: 设置 uPlot padding 留空间给header header 使用 position 定位 | ||
const headerH = this.ctrl.chartContainer.querySelector(`.${generateName('header')}`) | ||
.clientHeight || 0; | ||
// console.log(headerH, size) | ||
this.uPlot.setSize({ ...size, height: size.height - headerH }); | ||
@@ -148,0 +150,0 @@ // if (this.ctrl.getData().length) { |
/// <reference types="react" resolution-mode="require"/> | ||
/// <reference types="web" /> | ||
import uPlot from 'uplot'; | ||
import uPlot, { Padding } from 'uplot'; | ||
import { AdjustOption } from '../components/shape/bar.js'; | ||
@@ -14,3 +14,3 @@ import { SizeCallback } from '../components/shape/point.js'; | ||
height?: number; | ||
padding?: number[]; | ||
padding?: Padding; | ||
defaultInteractions?: string[]; | ||
@@ -27,3 +27,3 @@ options?: Options; | ||
height?: number; | ||
padding?: number[]; | ||
padding?: Padding; | ||
data?: Data; | ||
@@ -36,2 +36,3 @@ options?: Options; | ||
export interface Options { | ||
padding?: Padding; | ||
data?: Data; | ||
@@ -38,0 +39,0 @@ title?: TitleOption; |
@@ -9,2 +9,2 @@ import { ValueOf } from '../index.js'; | ||
export declare type ShapeType = ValueOf<typeof ShapeType>; | ||
export declare const SHAPE_TYPES: ("area" | "line" | "bar" | "point")[]; | ||
export declare const SHAPE_TYPES: ("line" | "area" | "bar" | "point")[]; |
{ | ||
"name": "zz-chart", | ||
"version": "0.1.0-beta.37", | ||
"version": "0.1.0-beta.38", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "author": "Alauda", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
542817
14178