Module Description
This module provides a Twig extension that enables you to generate charts in Twig using that Charts module API. Make sure you've installed the Charts module (including at least one submodule (and associated library), and set a default library at /admin/config/content/charts).
Your Twig might look something like:
{% set title = 'The Chart Title' %} {% set data = [10, 20, 30] %} {% set series = { 'my_series' : { 'title' : 'What is being plotted', 'data' : data } } %} {% set xaxis = { 'title' : 'X-Axis Label', 'labels' : ['a', 'b', 'c'] } %} {{ chart('my_twig_chart', 'column', title, series, xaxis, [], []) }} If you plan to use translation, use the |t or |trans filter in your Twig.
Your Twig might look something like:
{% set title = 'The Chart Title' %} {% set data = [10, 20, 30] %} {% set series = { 'my_series' : { 'title' : 'What is being plotted', 'data' : data } } %} {% set xaxis = { 'title' : 'X-Axis Label', 'labels' : ['a', 'b', 'c'] } %} {{ chart('my_twig_chart', 'column', title, series, xaxis, [], []) }} If you plan to use translation, use the |t or |trans filter in your Twig.
Module Link
Project Usage
139
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module aims to solve the generation of charts in Twig using the Charts module API.
Data Name
charts_twig