zz-chart
Advanced tools
Comparing version 0.1.1-beta.27 to 0.1.1-beta.28
@@ -0,1 +1,2 @@ | ||
/// <reference types="web" /> | ||
import { View } from '../../chart/view.js'; | ||
@@ -2,0 +3,0 @@ import { ShapeOptions } from '../../types/options.js'; |
@@ -1,2 +0,2 @@ | ||
import { TooltipOption } from '../types/index.js'; | ||
import { TooltipOption, TooltipValue } from '../types/index.js'; | ||
import { BaseComponent } from './base.js'; | ||
@@ -16,3 +16,3 @@ export declare class Tooltip extends BaseComponent<TooltipOption> { | ||
private getTooltipItem; | ||
handleTemplateString(text: string | number, formatter: string | ((v: string | number) => string)): string | number; | ||
handleTemplateString(text: string | number, formatter: string | ((v: string | number, data: TooltipValue) => string), data?: TooltipValue): string | number; | ||
showTooltip: () => void; | ||
@@ -19,0 +19,0 @@ hideTooltip: () => void; |
@@ -149,4 +149,4 @@ import { StyleSheet, css } from 'aphrodite/no-important.js'; | ||
?.map(item => { | ||
const value = this.handleTemplateString(item.value, valueFormatter); | ||
const name = this.handleTemplateString(String(item.name), nameFormatter); | ||
const value = this.handleTemplateString(item.value, valueFormatter, item); | ||
const name = this.handleTemplateString(String(item.name), nameFormatter, item); | ||
return `<li class="${css(styles['tooltip-list-item'])}" style="background: ${item.activated ? this.ctrl.getTheme().tooltip.activeBg : 'unset'}"> | ||
@@ -160,3 +160,3 @@ <span class="${css(symbolStyle.symbol)} ${css(symbolStyle.line)}" style="background: ${item.color};"></span> | ||
} | ||
handleTemplateString(text, formatter) { | ||
handleTemplateString(text, formatter, data) { | ||
let value = text; | ||
@@ -167,3 +167,3 @@ if (isString(formatter)) { | ||
if (isFunction(formatter)) { | ||
value = formatter(value); | ||
value = formatter(value, data); | ||
} | ||
@@ -170,0 +170,0 @@ return value; |
@@ -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'; |
@@ -98,4 +98,4 @@ /// <reference types="react" resolution-mode="require"/> | ||
titleFormatter?: string | ((title: string, values: TooltipValue[]) => string); | ||
nameFormatter?: string | ((name: string) => string); | ||
valueFormatter?: string | ((value: number) => string); | ||
nameFormatter?: string | ((name: string, data?: TooltipValue) => string); | ||
valueFormatter?: string | ((value: number, data?: TooltipValue) => string); | ||
itemFormatter?: (value: TooltipValue[]) => string | TooltipValue[] | Element; | ||
@@ -102,0 +102,0 @@ sort?: (a: TooltipValue, b: TooltipValue) => number; |
{ | ||
"name": "zz-chart", | ||
"version": "0.1.1-beta.27", | ||
"version": "0.1.1-beta.28", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Alauda Chart components by Alauda Frontend Team", |
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
846878
19664