ade0fc93232dc269b086aae373e3f75eef9048d3d82221f5e9b15ac68fb5f0fdde1b29b96e4950ea34d6ab69c6c068c64b3affb77e04a800feee1b480cde17 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { DataHost, DisplayState, CallbackDataParams, OptionDataValue, SeriesDataType, ComponentMainType, ComponentSubType, InterpolatableValue } from '../../util/types.js';
  2. import GlobalModel from '../Global.js';
  3. import { TooltipMarkupBlockFragment } from '../../component/tooltip/tooltipMarkup.js';
  4. export interface DataFormatMixin extends DataHost {
  5. ecModel: GlobalModel;
  6. mainType: ComponentMainType;
  7. subType: ComponentSubType;
  8. componentIndex: number;
  9. id: string;
  10. name: string;
  11. animatedValue: OptionDataValue[];
  12. }
  13. export declare class DataFormatMixin {
  14. /**
  15. * Get params for formatter
  16. */
  17. getDataParams(dataIndex: number, dataType?: SeriesDataType): CallbackDataParams;
  18. /**
  19. * Format label
  20. * @param dataIndex
  21. * @param status 'normal' by default
  22. * @param dataType
  23. * @param labelDimIndex Only used in some chart that
  24. * use formatter in different dimensions, like radar.
  25. * @param formatter Formatter given outside.
  26. * @return return null/undefined if no formatter
  27. */
  28. getFormattedLabel(dataIndex: number, status?: DisplayState, dataType?: SeriesDataType, labelDimIndex?: number, formatter?: string | ((params: object) => string), extendParams?: {
  29. interpolatedValue: InterpolatableValue;
  30. }): string;
  31. /**
  32. * Get raw value in option
  33. */
  34. getRawValue(idx: number, dataType?: SeriesDataType): unknown;
  35. /**
  36. * Should be implemented.
  37. * @param {number} dataIndex
  38. * @param {boolean} [multipleSeries=false]
  39. * @param {string} [dataType]
  40. */
  41. formatTooltip(dataIndex: number, multipleSeries?: boolean, dataType?: string): TooltipFormatResult;
  42. }
  43. declare type TooltipFormatResult = string | TooltipMarkupBlockFragment;
  44. /**
  45. * For backward compat, normalize the return from `formatTooltip`.
  46. */
  47. export declare function normalizeTooltipFormatResult(result: TooltipFormatResult): {
  48. frag: TooltipMarkupBlockFragment;
  49. text: string;
  50. };
  51. export {};