You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when using tooltip.axisPointer.label.formatter, (usually) there is no information, to which axis the data belongs. this makes it hard to format the value as desired.
Although the documatation talks about each item of the params.seriesData having axis information delivered with them, as shown in the example below, the params.seriesData is empty. this means that it's not possible to find axis information and options.
in our case, we would like to use the same formatter as defined for the axis to be used for axisPointer.label too, so access to axis.axisLabel.formatter is necessary.
I propose a mandatory property for value provided to tooltip.axisPointer.label.formatter, named axis, which contains information about the value's axis. this SHOULD BE AVAILABLE redgardless of params.seriesData.
as a solution, if the following line is added to dist\echarts.js line 68246, (or at src/component/axisPointer/viewHelper.js#L139) one can then access axis options and information. important is that the axis options, specially its formatter are provided.
/** * @param {number} value * @param {module:echarts/coord/Axis} axis * @param {module:echarts/model/Global} ecModel * @param {Object} opt * @param {Array.<Object>} seriesDataIndices * @param {number|string} opt.precision 'auto' or a number * @param {string|Function} opt.formatter label formatter */functiongetValueLabel(value,axis,ecModel,seriesDataIndices,opt){value=axis.scale.parse(value);vartext=axis.scale.getLabel(// If `precision` is set, width can be fixed (like '12.00500'), which// helps to debounce when when moving label.value,{precision: opt.precision});varformatter=opt.formatter;if(formatter){varparams={value: getAxisRawValue(axis,value),axis:axis,// <---- this line should be added to the codeseriesData: []};each$1(seriesDataIndices,function(idxItem){varseries=ecModel.getSeriesByIndex(idxItem.seriesIndex);vardataIndex=idxItem.dataIndexInside;vardataParams=series&&series.getDataParams(dataIndex);dataParams&¶ms.seriesData.push(dataParams);});if(isString(formatter)){text=formatter.replace('{value}',text);}elseif(isFunction$1(formatter)){text=formatter(params);}}returntext;}
The text was updated successfully, but these errors were encountered:
This issue is not created using issue template so I'm going to close it. 🙊
Sorry for this, but it helps save our maintainers' time so that more developers get helped.
Feel free to create another issue using the issue template.
your dumb echarts-bot has closed this issue without considering the fact that using your issue template is not possible, as your issue template sends the infromation using GET method, which fails when one tries to post such a detailed
What problem does this feature solve?
using Echarts v4.2.1
when using
tooltip.axisPointer.label.formatter
, (usually) there is no information, to which axis the data belongs. this makes it hard to format the value as desired.Although the documatation talks about each item of the
params.seriesData
having axis information delivered with them, as shown in the example below, theparams.seriesData
is empty. this means that it's not possible to findaxis
information and options.in our case, we would like to use the same
formatter
as defined for the axis to be used foraxisPointer.label
too, so access toaxis.axisLabel.formatter
is necessary.What does the proposed API look like?
I propose a mandatory property for value provided to
tooltip.axisPointer.label.formatter
, namedaxis
, which contains information about the value's axis. this SHOULD BE AVAILABLE redgardless ofparams.seriesData
.as a solution, if the following line is added to
dist\echarts.js
line68246
, (or at src/component/axisPointer/viewHelper.js#L139) one can then accessaxis
options and information. important is that theaxis
options, specially its formatter are provided.The text was updated successfully, but these errors were encountered: