ankane / chartkick

Create beautiful JavaScript charts with one line of Ruby

Home Page:https://chartkick.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding prefix/suffix for multi line chart

leoplct opened this issue · comments

I am using a line chart with 2 lines ($) on left-side and 1 line on right side (%) using the code below.
How can I add a prefix ($ sign) for each label for the 2 lines and a % suffix for each label on right-side?

I don't see anything the in the library: https://www.chartjs.org/docs/latest/charts/line.html

 settings = {colors: ["#DD7704", "#2E8CB8", "#474747"], library: {scales: {
            yAxes: [
              {
                id: 'cost',
                type: 'linear',
                position: 'left',
                scaleLabel: {display: true, labelString: "spend,sales"},
              },
              {
                id: 'ratio',
                type: 'linear',
                position: 'right',
                scaleLabel: {display: true, labelString: "Ratio"},
                ticks: {
                    suggestedMin: 0,
                    suggestedMax: 100
                }
                
              }
            ]
          }
        } }.merge(CHART_SETTINGS)
    
        line_chart(url, **settings)

Hey @leoplct, please use Stack Overflow for help customizing charts.