JohnCoene / echarts4r

🐳 ECharts 5 for R
http://echarts4r.john-coene.com/
Other
585 stars 82 forks source link

timeline with multiple-y-axis setting y axis doesn't work #601

Open pizifan opened 6 months ago

pizifan commented 6 months ago

I‘d want to expand the demo of multiple-y-axis (url: https://echarts.apache.org/examples/en/editor.html?c=multiple-y-axis) with timeline to show the different years of data changes. when I use it without timeline it works well as below: image

but when i use timeline it doesn't work : image

here are my codes: test %>% e_charts(month) %>% e_bar(Evaporation,name='Evaporation',y_index=1)%>% e_bar(Precipitation,name='Precipitation',y_index=2)%>% e_line(Temperature,name='temperature',lineStyle=list(color='#EE6666')) %>% e_y_axis(index =0 ,name='temperature', axisLine=list(show=T,lineStyle=list(color='#EE6666')), makepoint=list(symbol = 'circle'))%>%

e_grid(right='20%') %>%

e_y_axis(index = 1, name = "Evaporation",type='value', alignTicks=T,axisLine=list(show=T,lineStyle=list(color='#5470C6')), axisLabel=list( formatter='{value} ml'), splitLine=list(show=F)) |> e_y_axis(index=2, name = "Precipitation",offset=80,type='value', alignTicks=T,axisLine=list(show=T,lineStyle=list(color='#91CC75')), axisLabel=list( formatter='{value} ml'), splitLine=list(show=F))%>% e_axis( type= 'category', axisTick=list(alignWithLabel= T))%>% e_mark_point("temperature", data = list( name = "Max", type = "max" ))%>% e_mark_point("temperature", data = list( name = "Min", type = "min" ))%>% e_tooltip(trigger = 'axis', axisPointer=list( type='cross'))

with timeline codes: timeline_data%>% group_by(year)%>% e_charts(month,timeline = T)%>% e_bar(Evaporation,name='Evaporation',y_index=1)%>% e_bar(Precipitation,name='Precipitation',y_index=2)%>% e_line(Temperature,name='temperature',lineStyle=list(color='#EE6666'),y_index=0) %>% e_y_axis(index =0 ,name='temperature',position='left', type='value', axisLine=list(show=T,lineStyle=list(color='#EE6666')), makepoint=list(symbol = 'circle'))%>%

e_grid(right='20%') %>%

e_y_axis(index = 1, name = "Evaporation",type='value',position='right', alignTicks=T,axisLine=list(show=T,lineStyle=list(color='#5470C6')), axisLabel=list( formatter='{value} ml'), splitLine=list(show=F)) %>% e_y_axis(index=2, name = "Precipitation",offset=50,type='value',position='right', alignTicks=T,axisLine=list(show=T,lineStyle=list(color='#91CC75')), axisLabel=list( formatter='{value} ml'), splitLine=list(show=F))%>% e_axis( type= 'category', axisTick=list(alignWithLabel= T))%>% e_tooltip(trigger = 'axis', axisPointer=list( type='cross'))

e_y_axis setting seems work on the last index . Could you help me to solve it ? Thanks a lot!