Dear echarts dev team:
I encountered some misunderstanding when following this example:

https://echarts.apache.org/examples/en/editor.html?c=candlestick-brush&edit=1&reset=1&lang=ts

In line #48, there is the tooltip option set as the key of option object:

tooltip: {
        trigger: 'axis',
        axisPointer: {
          type: 'cross'
        },
        borderWidth: 1,
        borderColor: '#ccc',
        padding: 10,
        textStyle: {
          color: '#000'
        },
        position: function (pos, params, el, elRect, size) {
          const obj: Record<string, number> = {
            top: 10
          };
          obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 30;
          return obj;
        }
        // extraCssText: 'width: 170px'
      },

while in line #193, there is also a tooltip value set in series array:
tooltip: {
            formatter: function (param: any) {
              param = param[0];
              return [
                'Date: ' + param.name + '<hr size=1 style="margin: 3px 0">',
                'Open: ' + param.data[0] + '<br/>',
                'Close: ' + param.data[1] + '<br/>',
                'Lowest: ' + param.data[2] + '<br/>',
                'Highest: ' + param.data[3] + '<br/>'
              ].join('');
            }
          }

The example made me think the 'tooltip' option is functional in both 
option.tooltip and option.series.tooltip, while the latter doesn't seem to work 
in my own code. (In fact it doesn't work in the example too which I didn't 
found out at the first place.)

As I referred to the documententation, I noticed a reminder in this page:

https://echarts.apache.org/en/option.html#series-candlestick.tooltip.formatter

saying: "Notice: series.tooltip only works when tooltip.trigger is 'item'."

Obviously as the option.tooltip.trigger in the example is set to 'axis'. ( line 
#49 ), code start in #193 that set tooltip in series array is redundant . I 
suppose that it should be fixed to avoid any misleading for beginners like me.

With respect
Nessaj
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org
For additional commands, e-mail: dev-h...@echarts.apache.org

Reply via email to