ApexCharts Ruby
  • About
  • Installation
  • Usage
    • Cartesian Charts
      • Cartesian Charts: Part 1
        • Line Chart
        • Stepline Chart
        • Area Chart
        • Column Chart
        • Bar Chart
        • Range Bar Chart
      • Cartesian Charts: Part 2
        • Scatter Chart
        • Candlestick Chart
        • Box Plot Chart
      • Cartesian Charts: Part 3
        • Mixed Charts
        • Syncing Charts
        • Brush Chart
        • Annotations
        • Multiple Y-Axes
    • Heatmap Chart
    • Radar Chart
    • Bubble Chart
    • Polar Charts
      • Pie Chart
      • Donut Chart
      • Radial Bar Chart
  • Data Formats
    • Cartesian Charts
      • Candlestick Chart
      • Box Plot Chart
    • Heatmap Chart
    • Radar Chart
    • Bubble Chart
    • Polar Charts
  • Options
    • Introduction
    • Global Options
    • Formatter Function
    • Defer Chart Rendering
    • Render within a script with type module
  • Miscellaneous
    • Reusable Custom Palette
    • Use Alongside Other Charting Libraries
      • Alongside Chartkick
        • Chartkick (Chart.js) and ApexCharts
        • Chartkick (Google Charts) and ApexCharts
        • Chartkick (Highcharts) and ApexCharts
    • Web Support
      • Rails
      • Sinatra
      • Middleman
      • Plain HTML+ERB (Without Framework)
Powered by GitBook
On this page
  1. Miscellaneous

Use Alongside Other Charting Libraries

You can prefix the helper methods name with your chosen words to avoid name clashing with other charting libraries (e.g. chartkick, google_charts, etc.) you already use. Just set the APEXCHARTS_PREFIX environment variable to a string before you start your app server, say, 'awesome_' and then on your views/templates use the chart helpers as awesome_line_chart, awesome_area_chart, and so on.

Besides setting the environtment variable, if you just want a quick prefix, you can instead do this on your Gemfile:

gem 'apexcharts', require: 'apex_charts/prefix_with_apex'

and you'll get apex_line_chart, apex_area_chart, etc.

The prefix you set only applies to the outer chart helpers. The inner chart helpers is not prefixed. For example:

<%= awesome_syncing_chart(syncing_options) do %>
  <% combo_chart(mixed_options) do %>
    <% line_chart(line_series) %>
    <% area_chart(area_series) %>
  <% end %>
<% end %>
PreviousReusable Custom PaletteNextAlongside Chartkick

Last updated 1 year ago