rCharts用于某些功能,例如闪亮app中的时间轴

时间:2021-04-06 07:13:53

I am using rCharts in shiny app. rCharts is a very useful package for visualization. when we move mouse above the figure ,then it will hint me some messege. for example, i have a dataframe like !data.frame(date=c(....),revenue=c(....))

我在闪亮的应用程序中使用rCharts。 rCharts是一个非常有用的可视化包。当我们将鼠标移到图上方时,它会暗示我一些信息。例如,我有一个数据框,如!data.frame(date = c(....),revenue = c(....))

then when make it into a plot , when mouse moved on it will tell us the date and the revenue,

然后当把它变成一个情节时,当鼠标移动它时会告诉我们日期和收入,

but I want change this message such as when mouse point to it ,it will tell me what happend in that day , so i can change the dataframe like this :data.frame(date=c(....),revenue=c(....),events=c(...))

但是我想改变这个消息,例如当鼠标指向它时,它会告诉我当天发生了什么,所以我可以改变这样的数据帧:data.frame(date = c(....),revenue = c (......),事件= C(...))

if it is comes ture ,it will be very easy to check what events have happend to influence my revenue. if any body knows how to realize it ,please tell me! thanks.

如果它是真的,那么很容易检查发生了什么事件来影响我的收入。如果有人知道如何实现它,请告诉我!谢谢。

1 个解决方案

#1


1  

If I understand correctly, you want to adjust the tooltip to display the events column.

如果我理解正确,您需要调整工具提示以显示事件列。

Here's an example where I want to plot the disp column against the hp column, but the tooltip hover should display the gear column.

这是一个示例,我想在hp列上绘制disp列,但工具提示悬停应显示齿轮列。

n<-nPlot(disp~hp,data=mtcars,type='lineChart')
n$chart(
  tooltipContent="#! function(key, x, y, e){
  return  e.point.gear
} !#"
  )

You can add whatever html you want to the tooltipContent to format things to your liking.

您可以将任何想要的html添加到tooltipContent中,以根据自己的喜好对事物进行格式化。

#1


1  

If I understand correctly, you want to adjust the tooltip to display the events column.

如果我理解正确,您需要调整工具提示以显示事件列。

Here's an example where I want to plot the disp column against the hp column, but the tooltip hover should display the gear column.

这是一个示例,我想在hp列上绘制disp列,但工具提示悬停应显示齿轮列。

n<-nPlot(disp~hp,data=mtcars,type='lineChart')
n$chart(
  tooltipContent="#! function(key, x, y, e){
  return  e.point.gear
} !#"
  )

You can add whatever html you want to the tooltipContent to format things to your liking.

您可以将任何想要的html添加到tooltipContent中,以根据自己的喜好对事物进行格式化。