In your view file
<%= column_chart(async_traffic_forecast_path(resource, params[:id]),
library: {
legend: { position: 'top' },
scales: {
'y' => {
"type" => 'linear',
"display" => true,
"position" => 'left'
},
'another-y-axis' => {
"type" => 'linear',
"display" => true,
"position" => 'right'
}
}
}
) %>
in your controller
traffic_data_response = [
{ data: views, name: "Views", library: { yAxisID: "y" } },
{ data: other_views, name: "Other Views", library: { yAxisID: "y" } },
{ data: total_conversion, name: "Conversion", library: { yAxisID: "another-y-axis" } }
{ data: other_conversion, name: "Other Conversion", library: { yAxisID: "another-y-axis" } }
]