echarts themeRiver get all data of the river in the formatter. 主题河流图获取某一河流在所有时间点的数据

owfi6suc  于 2022-12-31  发布在  Echarts
关注(0)|答案(8)|浏览(213)

What problem does this feature solve?

希望主题河流图(themeRiver)获取某一河流在所有时间点的数据,而不是所有河流在某一时间点的数据。

当前是根据坐标轴获取数据的,而主题河流图只支持单坐标轴(singleAxis),是否可以添加Y坐标轴或者以其他方式获取某一河流的数据?

我们做一个学术文献关键词热点分析的项目,当生成的河流较多(比如20个),其中某些河流占比很小时,鼠标放上去会悬浮出(tooltip)某一时间节点所有的数据,这样的显示效果并不理想。我们期望显示某一关键词近几年的变化趋势。

What does the proposed API look like?

formatter: function (params, ticket, callback) {
      console.log(params.item)   // 河流名称
}
goucqfw6

goucqfw61#

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

Have a nice day! 🍵

mtb9vblg

mtb9vblg2#

顺便请问一下,目前有实现类似效果的方案吗?

3duebb1j

3duebb1j4#

@smallyunet, Do you want the whole data of a river to custom the tooltip?

vfh0ocws

vfh0ocws5#

@deqingli

Only the river name is needed, it can be used as a key to find all the data.
Of course, it would be better if there is all the data, but it is not necessary.

guykilcj

guykilcj6#

Sorry, I don't understand your problem, I wonder if the following code can meet your question:

// the raw data you input into echarts

var initialData = [['2015/11/08',10,'DQ'],['2015/11/09',15,'DQ'],['2015/11/10',35,'DQ'],
                      ['2015/11/08',35,'TY'],['2015/11/09',36,'TY'],['2015/11/10',37,'TY'],
                      ['2015/11/17',36,'SS'],['2015/11/18',33,'SS'],['2015/11/19',43,'SS']];

formatter: function (params) {
    var name = params[0].name;
    var riverName = [];
    for (var i = 0; i < initialData.length; i++) {
        if (initialData[i][2] === name) {
            riverName.push(initialData[i]);
        }
    }
    console.log(riverName)   // All the data of a river
}
bpsygsoo

bpsygsoo7#

Sorry, I didn't clearly describe the problem. As your example, the value of the parameter name will not change. I hope that the contents of the hover box can change as the mouse position changes.

My trouble is that the theme river map is a single axis, and the parameter param of the formatter function can only dynamically get the value of the axis (date).

In other words, the parameter value of the function formatter can only change with the lateral movement of the mouse, and does not change with the vertical movement of the mouse.

I hope that the content of the floating window in the image can be the data of SS at all times, not the data of all rivers in 11-04-2015 .

And with the vertical movement of the mouse, the contents of the floating box will display the data of the rivers such as DQ , TY . The content of the current hover box can only change with the date.

This may seem a bit difficult and should be. I just want to make a suggestion and communicate at any time.

@deqingli

ha5z0ras

ha5z0ras8#

@smallyunet Thank you for your suggestion and detailed message, I will follow up this issue.

相关问题