Adding ability to set the opacity of an area chart or series

Created on 18 May 2017, almost 8 years ago
Updated 11 March 2025, about 2 months ago

Problem/Motivation

It is currently not possible to change the opacity of a chart or series when using an area chart. Currently the series line is 100% opacity (1.0) and the chart area defaults to the opacity of the library (0.3 for Google Charts and 0.75 for Highcharts).

The first screenshot is the current behaviour.

Proposed resolution

Adding the areaOpacity option to a chart to define the opacity of the series or the whole chart.

1) Setting the areaOpacity for a series

$chart['in_progress'] = array(
    '#type' => 'chart_data',
    '#title' => 'In progress',
    '#data' => array(3,4,4,3,3,4,4,4,4,3,3,3),
    '#marker_radius' => 0,
    '#areaOpacity' => 1,
  );

The second screenshot shows 100% opacity being set on alternate series

2) Setting the areaOpacity across a whole chart

  $chart = array(
    '#type' => 'chart',
    '#chart_type' => 'area',
    '#title' => t('Cumulative Flow Diagram'),
    '#legend_position' => 'top',
    '#stacking' => TRUE,
    '#areaOpacity' => 1,
);

The third screenshot shows 100% opacity being set across the whole chart.

Feature request
Status

Closed: outdated

Version

2.0

Component

Chart API

Created by

🇮🇪Ireland brenv

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States bluegeek9

    Thank you for your contributions to this issue. As Drupal 7 has reached its End of Life and is no longer supported, we are closing this issue. We encourage you to upgrade to a supported version of Drupal.

Production build 0.71.5 2024