Account created on 22 June 2012, almost 13 years ago
#

Merge Requests

More

Recent comments

🇺🇸United States andileco

Thanks for your review, @routinet!

🇺🇸United States andileco

I want people to go with another, more-active library.

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

Yes, we can add it. @bluegeek9, do you have time to work on it?

🇺🇸United States andileco

@bluegeek9, I see everything is green. Is there more you wanted to do on this, or is it ready for review?

🇺🇸United States andileco

Very excited to have this one in!

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

I'm going to close this, because I agree a custom module is the best solution for this for now. However, here's how you could do this:

MY_MODULE.info.yml

name: 'Highcharts Wordcloud'
type: module
description: 'Enables creation of Wordclouds using the Highcharts library.'
core_version_requirement: ^10.3 || ^11
package: Examples
dependencies:
  - 'charts:charts'
  - 'charts:charts_highcharts'

MY_MODULE.libraries.yml

MY_MODULE:
  version: VERSION
  js:
    /libraries/highcharts_wordcloud/wordcloud.js: { minified: true }
  cdn:
    /libraries/highcharts_wordcloud/wordcloud.js: https://code.highcharts.com/12.1.1/modules/wordcloud.js
  dependencies:
    - charts/global
    - charts_highcharts/charts_highcharts
    - charts_highcharts/highcharts

MY_MODULE.module

<?php

/**
 * Implements hook_chart_alter().
 */
function MY_MODULE_chart_alter(array &$element, $chart_id) {
  $element['#attached']['library'][] = 'MY_MODULE/MY_MODULE';
}

/**
 * Implements HOOK_charts_plugin_supported_chart_types_alter().
 */
function MY_MODULE_charts_plugin_supported_chart_types_alter(array &$types, string $chart_plugin_id) {
  if ($chart_plugin_id === 'highcharts') {
    $types[] = 'wordcloud';
  }
}

MY_MODULE.charts_types.yml

wordcloud:
  label: 'Wordcloud'
  axis: 'y_only'
  axis_inverted: false
  stacking: false

MY_MODULE.routing.yml

MY_MODULE.display:
  path: /wordcloud-example
  defaults:
    _controller: '\Drupal\MY_MODULE\Controller\MyModule::display'
    _title: 'A Wordcloud'
  requirements:
    _permission: 'access content'

src/Controller/MyModule.php

<?php

namespace Drupal\charts_api_example\Controller;

use Drupal\Component\Uuid\UuidInterface;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Extension\ModuleExtensionList;
use Drupal\Core\Messenger\MessengerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Charts Api Example.
 */
class ChartsApiExample extends ControllerBase {

  /**
   * Display the dashboard of charts.
   *
   * @return array
   *   Array to render.
   */
  public function display() {

    // This is a container for the word cloud.
    $charts_container = [
      '#type' => 'container',
      'content' => [],
    ];

    $data = 'Chapter 1. Down the Rabbit-Hole ' .
      'Alice was beginning to get very tired of sitting by her sister on ' .
      'the bank, and of having nothing to do: ' .
      'once or twice she had peeped into the book her sister was reading, ' .
      'but it had no pictures or conversations ' .
      'in it, \'and what is the use of a book,\' thought Alice ' .
      '\'without pictures or conversation?\'' .
      'So she was considering in her own mind (as well as she could, for ' .
      'the hot day made her feel very sleepy ' .
      'and stupid), whether the pleasure of making a daisy-chain would be ' .
      'worth the trouble of getting up and picking ' .
      'the daisies, when suddenly a White Rabbit with pink eyes ran close ' .
      'by her.';
    // Convert text to lowercase and remove punctuation
    $text = strtolower($data);
    $text = preg_replace('/[^\p{L}\p{N}\s]/u', '', $text);

    // Split text into words
    $words = preg_split('/\s+/', $text, -1, PREG_SPLIT_NO_EMPTY);

    // Count word frequencies.
    $word_counts = array_count_values($words);

    // Format the result.
    $result = [];
    foreach ($word_counts as $word => $count) {
      $result[] = [
        'name' => $word,
        'weight' => $count
      ];
    }
    $charts_container['content']['wordcloud'] = [
      '#type' => 'chart',
      '#library' => 'highcharts',
      '#title' => $this->t('Highcharts Word Cloud'),
      '#chart_type' => 'wordcloud',
      'series' => [
        '#type' => 'chart_data',
        '#title' => $this->t('Occurances'),
        '#data' => $result,
      ],
    ];

    return $charts_container;
  }
}

🇺🇸United States andileco

I want to re-examine the way I'm getting array values from the ChartDataCollectorTable class.

🇺🇸United States andileco

Thank you, @loopy1492! I really appreciate the effort you took to understand the new structure and to upgrade - this really helps me (and others) focus on the current version and make that the best it can be. Thank you also for contributing the code examples!

🇺🇸United States andileco

I think this is actually handled already by the library class attributes.

🇺🇸United States andileco

I did publish the module I mentioned. It probably needs a little maintenance: https://www.drupal.org/project/charts_highstock

🇺🇸United States andileco

Thank you - looks good!

🇺🇸United States andileco

I had to make an adjustment or none of the charts would show.

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

Thank you! I plan to review this afternoon.

🇺🇸United States andileco

andileco changed the visibility of the branch 5.1.x to hidden.

🇺🇸United States andileco

andileco changed the visibility of the branch 3391197-enable-support-for to hidden.

🇺🇸United States andileco

Opening back up to add in the use statements.

🇺🇸United States andileco

Yes, no one has volunteered to work on tests, and if someone wants to, they can open a new ticket.

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

Unfortunately the C3.js library hasn't been updated for a long time and that version of D3 breaks some of the chart types. Billboard.js is a fork of C3.js and has additional chart type options. All users are encouraged to use Billboard over C3. Going to close this.

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

Thank you! I have a few things to work out like making it so that libraries required by the view can be included without bringing in all the rest of the page template. I hope to release a Drupal 10/11 version within a couple weeks.

🇺🇸United States andileco

This module did not get a modern version Drupal version. I have built a functioning modern Drupal version here (though I want to become maintainer before I invest time in finishing it completely): https://www.drupal.org/project/views_share/issues/3025018 Drupal 8 version? Active

🇺🇸United States andileco

Fixed. Sorry for the delay.

🇺🇸United States andileco

Going ahead and committing since I did observe a fix on my views-based Gauge chart, and this seems to also align with the form field types for those values anyway.

🇺🇸United States andileco

Looks great, and thanks for letting me know about the DDEV Contrib Plugin - I've been using Lando and haven't experienced that.

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

@loopy1492 - it's very different, but 5.x is much better and it doesn't make sense to maintain such different versions. Please help me create documentation or more of an upgrade path rather than continuing with the 8.x version.

🇺🇸United States andileco

Thank you, @diaodiallo!

🇺🇸United States andileco

@simonknight - please try the merge request (https://git.drupalcode.org/project/charts/-/merge_requests/134.patch) - I think it will fix it. Seems like the issue is just the older library was more accepting of the to and from being strings versus integers.

🇺🇸United States andileco

Sorry to hear about this, and glad you have a quick fix. Would you be willing to (on a dev instance) go to /admin/config/content/charts/advanced and select "Enable Charts Debug" (save), and then go back to your gauge chart and copy and share the JSON in the fieldset below your chart?

Do you have any custom code related to charts on your site?

Thanks!

🇺🇸United States andileco

Some people need that build step where they can have Composer pull in the libraries. You can also just place the files you need inside a properly named libraries directory. Or you can use the CDN option. There are other modules that can help install libraries, too.

I'm not sure how you got to where you are, as I tried on a fresh site and didn't experience any issues. But if you wanted to start fresh, you could try uninstalling and reinstalling Charts, you can go to /admin/config/content/charts, select your chosen charting library, hit save, then visit the "Advanced" tab and make sure the CDN is enabled.

Hope this helps!

🇺🇸United States andileco

Thanks for catching that...not sure why that happened.

🇺🇸United States andileco

It's inside the charts module: charts/modules/charts_chartjs/README.md

🇺🇸United States andileco

I've tried to replicate this and haven't been able to. Any more ideas how I can get it to fail?

🇺🇸United States andileco

For that, please check out the README.md in charts_chartjs. I'll look into this issue.

🇺🇸United States andileco

Thank you for reporting. What version of Drupal are you on? What are the steps you took before the error occurred? Did you already have charts installed?

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

Thank you for sharing. Is there an action item for the Charts module? I'm not using TMGMT, so it's hard for me to test this.

🇺🇸United States andileco

@gstivanin - I did some manual testing and didn't find any issues with your patch, but I also didn't experience this issue in the first place. It would help to be able to recreate the issue...can you provide specific instructions for how to do that?

🇺🇸United States andileco

I tested this and couldn't find any reason not to use it, though it wasn't needed for me either.

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

Thank you @ludo.r - I made a couple adjustments to include donut as well. I tested with Chart Field, Charts API Example, and Views.

🇺🇸United States andileco

andileco made their first commit to this issue’s fork.

🇺🇸United States andileco

I ended up making the adjustments for this in https://www.drupal.org/project/charts_highcharts_maps/issues/3511054 📌 Improve color-handling, including for grouped maps Active because I needed them to have functional manual tests.

Production build 0.71.5 2024