zz-chart
Advanced tools
Comparing version 0.1.1-beta.39 to 0.1.1-beta.40
import { AxisOpt } from '../types/index.js'; | ||
import { BaseComponent } from './base.js'; | ||
import { axisAutoSize } from './uplot-lib/index.js'; | ||
export declare class Axis extends BaseComponent<Record<'x' | 'y', AxisOpt>> { | ||
@@ -8,5 +9,11 @@ name: string; | ||
getOptions(): { | ||
axes: { | ||
axes: ({ | ||
values: (string | number)[][] | ((_u: import("uplot"), splits: string[]) => string[]); | ||
}[]; | ||
} | { | ||
size?: undefined; | ||
values: (u: import("uplot"), splits: string[], axisIdx: number, tickSpace: number, tickIncr: number) => string[]; | ||
} | { | ||
size: typeof axisAutoSize; | ||
values: (u: import("uplot"), splits: string[], axisIdx: number, tickSpace: number, tickIncr: number) => string[]; | ||
})[]; | ||
}; | ||
@@ -13,0 +20,0 @@ private getXOptions; |
@@ -40,7 +40,10 @@ import { get, isFunction } from 'lodash'; | ||
const yValues = yFormatter | ||
? (_u, splits) => splits.map(d => { | ||
return isFunction(yFormatter) | ||
? yFormatter(String(d)) | ||
: template(yFormatter, { value: d }); | ||
}) | ||
? (u, splits, axisIdx, tickSpace, tickIncr) => { | ||
const params = { u, splits, axisIdx, tickSpace, tickIncr }; | ||
return splits.map(d => { | ||
return isFunction(yFormatter) | ||
? yFormatter(String(d), params) | ||
: template(yFormatter, { value: d }); | ||
}); | ||
} | ||
: null; | ||
@@ -47,0 +50,0 @@ const ySize = autoSize === false ? {} : { size: axisAutoSize }; |
@@ -54,5 +54,4 @@ import { get, isNumber } from 'lodash'; | ||
const { max, min } = this.option.y || {}; | ||
const notAuto = !isNumber(max) && !isNumber(min); | ||
return { | ||
auto: notAuto, | ||
auto: true, | ||
range: (_u, dataMin, dataMax) => { | ||
@@ -74,3 +73,3 @@ const rangeConfig = { | ||
const minMax = uPlot.rangeNum(min != null && min != undefined ? min : dataMin, max != null && max != undefined ? max : dataMax, rangeConfig); | ||
return [Math.min(0, minMax[0]), minMax[1]]; | ||
return [minMax[0], minMax[1]]; | ||
}, | ||
@@ -77,0 +76,0 @@ }; |
@@ -0,3 +1,3 @@ | ||
/// <reference types="web" /> | ||
/// <reference types="react" resolution-mode="require"/> | ||
/// <reference types="web" /> | ||
import { View } from '../../chart/view.js'; | ||
@@ -4,0 +4,0 @@ import { ShapeOptions } from '../../types/index.js'; |
@@ -0,1 +1,2 @@ | ||
/// <reference types="web" /> | ||
import uPlot from 'uplot'; | ||
@@ -2,0 +3,0 @@ import { ShapeOptions } from '../../types/index.js'; |
@@ -0,1 +1,3 @@ | ||
/// <reference types="react" resolution-mode="require"/> | ||
/// <reference types="web" /> | ||
import UPlot from 'uplot'; | ||
@@ -2,0 +4,0 @@ import { Data, Size } from '../types/index.js'; |
@@ -92,3 +92,3 @@ /// <reference types="react" resolution-mode="require"/> | ||
autoSize?: boolean; | ||
formatter?: string | ((value: string | number) => string); | ||
formatter?: string | ((value: string | number, uPlotParams?: unknown) => string); | ||
} | ||
@@ -95,0 +95,0 @@ export declare type TooltipOption = TooltipOpt | boolean; |
{ | ||
"name": "zz-chart", | ||
"version": "0.1.1-beta.39", | ||
"version": "0.1.1-beta.40", | ||
"type": "module", | ||
@@ -70,3 +70,3 @@ "description": "Alauda Chart components by Alauda Frontend Team", | ||
"placement.js": "^1.0.0-beta.5", | ||
"uplot": "^1.6.26" | ||
"uplot": "^1.6.30" | ||
}, | ||
@@ -73,0 +73,0 @@ "devDependencies": { |
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
919325
21557
Updateduplot@^1.6.30