How to use the @antv/component/lib.Tooltip.Mini function in @antv/component

To help you get started, we’ve selected a few @antv/component examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github antvis / G2 / src / chart / controller / tooltip.js View on Github external
}, defaultCfg, options);
    if (options.crosshairs && options.crosshairs.type === 'rect') {
      options.zIndex = 0; // toolip 背景框不可遮盖住 geom,防止用户配置了 crosshairs
    }

    options.visible = false;
    // @2018-09-13 by blue.lb 如果设置shared为false不需要指定position
    // if (options.shared === false && Util.isNil(options.position)) {
    //   options.position = 'top';
    // }
    let tooltip;
    if (options.type === 'mini') {
      options.crosshairs = false;
      // this.options.shared = false;
      options.position = 'top';
      tooltip = new Tooltip.Mini(options);
    } else if (options.useHtml) {
      tooltip = new Tooltip.Html(options);
    } else {
      tooltip = new Tooltip.Canvas(options);
    }
    self.tooltip = tooltip;

    const triggerEvent = self._getTriggerEvent();
    const tooltipContainer = tooltip.get('container');
    if (!tooltip.get('enterable') && triggerEvent === 'plotmove') { // 鼠标不允许进入 tooltip 容器
      if (tooltipContainer) {
        tooltipContainer.onmousemove = e => {
          // 避免 tooltip 频繁闪烁
          const eventObj = self._normalizeEvent(e);
          chart.emit(triggerEvent, eventObj);
        };