Hello,

I would like to see support for the 'gauge' type charts.

I have created a patch as can be found below (for google).

If I need to make any changes to this then please let me know.

Many thanks,

Steven

Comments

sjs205’s picture

Status: Active » Needs review
Pierre.Vriens’s picture

Status: Needs review » Needs work
Issue tags: +Novice
Parent issue: » #2395779: Charts 7.x-3.x Release

Sorry it took so long to get back to this issue (I only recently became a new maintainer), but thank you @sjs205 for this patch. I've done a first review of the submitted patch, and think we should indeed consider adding support for this extra chart type. Which is why I already added the parent link for now.

However, there is some extra work to do to get this moving forward, i.e.:

  1. At first I was surprised about the rather large size of the patch. But it appears that there are quite some changes in the proposed patch that are not really related to adding support for gauge charts for google charts. All they are about is shifting lines of code a bit to the left or right. I suggest somebody reworks this patch so that only the relevant changed lines remain (hence the 'Novice' tag I added for now)?
  2. Compliant to the instructions when creating a new charts issue, a Highcharts equivalent needs to be added, probably starting from the Highcharts demo sample.

Not sure if that's all that will be needed, but at least they seem prereqs to me to move forward with it.

PS: #1876664: Google Chart Gauge Feature Request seems an interesting similar issue ...

Pierre.Vriens’s picture

Title: Support for gauge type google charts » Support for gauge charts
Component: Google Charts integration » Chart API
Issue summary: View changes
Parent issue: #2395779: Charts 7.x-3.x Release » #2382151: Charts 7.x-2.0 Release

I'd like to try getting this new type of chart supported in the 7.x-2.x release already ... anybody out there to submit a patch for the (still missing) HC-equivalent?

sjs205’s picture

Hello,

Apologies, I clearly can't have looked at that patch after I created it.

I have recreated the patch against charts-7.x-2.0-rc1. Please see attached.

I will try to get something together for highcharts - I've never actually tried the highcharts library...

Many thanks, and apologies for the abysmal initial patch.

Steven

lahode’s picture

Hi, thanks for your patch! (So lucky you posted it yersterday)

I tried to test it, but it seems so different options needed for each chart type, could you please provide a simple exemple on how to create a gauge chart with the API?

Thank you in advance

Cheers

lahode’s picture

Hi again,

I figured out my problem, I was using highcharts instead of Google charts, that's why nothing came up:

For those interested, here is an quick example. However, please notice that the Green doesn't show up

  $chart = array(
    '#type' => 'chart',
    '#chart_type' => 'gauge',
    '#chart_library' => 'google',
    '#title' => t('Gauge Chart'),
    '#min' => 0,
    '#max' => 100,
    '#width' => 400,
    '#height' => 400,
    '#greencolor' => '#00AA10',
    '#greenfrom' => 0,
    '#greento' => 75,
    '#redfrom' => 90,
    '#redto' => 100,
    '#redcolor' => '#FF5533',
    '#yellowfrom' => 75,
    '#yellowto' => 90,
    '#yellowcolor' => '#DDBB88',
    '#minorticks' => 5,
  );

  $chart['pressure'] = array(
    '#type' => 'chart_data',
    '#title' => t('Pressure'),
    '#data' => array(array('Pressure', 95)),
  );

  $chart['liquid'] = array(
    '#type' => 'chart_data',
    '#title' => t('Liquid'),
    '#data' => array(array('Liquid', 3)),
  );

  $example['chart'] = $chart;

  return drupal_render($example);
sjs205’s picture

"please notice that the Green doesn't show up"

Green works perfectly for me. Try setting 'greento' to 1 rather than 0...

jiintac’s picture

Hi, is there an official release for gauge chart?

thedut’s picture

StatusFileSize
new75.12 KB
new19.53 KB

Hello,

This patch replace previous ones and add UI support for defining colors section of the gauge, see picture.
it is functionnal, but it still need some work :

  • Hide Gauge fieldset using jquery when Gauge type is not selected (into the charts/js/charts.admin.js file).
  • Add support for others features : majorticks and minorticks, greencolor, yellowcolor, redcolor (into the charts/includes/charts.pages.inc file)
  • create a gauge demo
  • Maybe : add supoort for highcharts gauge to.

gauge UI
gauge img

thedut’s picture

bluegeek9’s picture

Status: Needs work » Closed (outdated)
Issue tags: -

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.