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

Merge Requests

More

Recent comments

🇺🇸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.

🇺🇸United States andileco

This may cause users to need to re-add/save their subtitle.

🇺🇸United States andileco

This is a good enough initial implementation that I'm going to move forward with it. There are some aspects like that the annotation gets wrapped in a tag, but that can be addressed with CSS.

🇺🇸United States andileco

Thank you for confirming! Marking fixed.

🇺🇸United States andileco

Please make sure you've cleared caches. To help me debug, can you add:
\Drupal::messenger()->addMessage(json_encode($query_options['csv_file']).' QO-A');
before
if (!empty($query_options['csv_file'])) { (between line 812 and 813)
and
\Drupal::messenger()->addMessage(json_encode($query_options['csv_file']).' QO-B');
just before
if (!$query_options['headers']) { (between line 815 and 816)?

Can you also add
\Drupal::messenger()->addMessage(json_encode($uri).' A');
before
$uri = $this->token->replace($uri); (line 794)
and
\Drupal::messenger()->addMessage(json_encode($uri).' B');
immediately after
$uri = $this->token->replace($uri); (line 796)?

🇺🇸United States andileco

@msn5158 - please try the MR/patch - I think this will fix it.

We may also create a new feature request to get View (Twig) tokens from the first row, like you can see in Header/Footer/No Result Behavior plugins.

🇺🇸United States andileco

That's awesome! I'll let you figure out the donut chart. But for the column chart, you can update your y_axis to look like this:

'y_axis' => [
  '#type' => 'chart_yaxis',
  '#title' => !empty($content['field_chart_yaxis_title']['#items']->getString()) ? $content['field_chart_yaxis_title']['#items']->getString() : '',
  '#raw_options' => [
    'stackLabels' => [
      'enabled' => TRUE,
    ],
  ],
],

Please note, this code above is using '#raw_options' *inside* the y_axis array. There's also a '#raw_options' for the chart as a whole, but don't use that for this.

🇺🇸United States andileco

Thank you for this issue and for looking into this thoroughly. We made some changes to that section to make it easier to get files that had been uploaded to the site. It's definitely possible something was damaged. We'll look into it as soon as possible.

🇺🇸United States andileco

Thanks for explaining.

Your hook would look something more like:

function abc_preprocess_paragraph__infographic(&$variables) {
  
  $content = $variables['content'];
  $charts_settings = \Drupal::config('charts.settings');
  $options = $charts_settings->get('charts_default_settings');
  $type = !empty($content['field_chart_type']['#items']) ? $content['field_chart_type']['#items']->getString() : 'column';
  // The chart render array.
  $variables['my_cool_chart'] = [
    '#chart_library' => $options['library'],
    '#type' => 'chart',
    '#title' => '', // DO YOU HAVE A TITLE?
    '#chart_type' => $type,
    '#width' => $options['display']['dimensions']['width'],
    '#height' => $options['display']['dimensions']['height'],
    '#width_units' => $options['display']['dimensions']['width_units'],
    '#height_units' => $options['display']['dimensions']['height_units'],
    'x_axis' => [
      '#type' => 'chart_xaxis',
      '#title' => !empty($content['field_chart_xaxis_title']['#items']->getString()) ? $content['field_chart_xaxis_title']['#items']->getString() : '',
      '#labels' => (!empty($content['field_chart_categories']['#items']->getString())) ? explode(',', $content['field_chart_categories']['#items']->getString()) : [],
    ],
    'y_axis' => [
      '#type' => 'chart_yaxis',
      '#title' => !empty($content['field_chart_yaxis_title']['#items']->getString()) ? $content['field_chart_yaxis_title']['#items']->getString() : '',
    ],
    '#raw_options' => [],
  ];
  
  if (!empty($content['field_chart_data']['#items'])) {
    $variables['my_cool_chart']['series'] = [
      '#type' => 'chart_data',
      '#title' => '',
      '#color' => '',
      '#data' => array_map('intval', explode(',', $content['field_chart_data']['#items']->getString())),
    ];
  }
  if ($type === 'column'
    && $content['field_chart_series']['#items']->getString()
    && !empty($content['field_chart_multiple_series']['#items'])
  ) {
    foreach ($content['field_chart_multiple_series']['#items']->getValue() as $serie) {
      $serie_entity = \Drupal\paragraphs\Entity\Paragraph::load($serie['target_id']);
      $variables['my_cool_chart']['series_' . $serie['target_id']] = [
        '#type' => 'chart_data',
        '#title' => $serie_entity->field_chart_series_name->getString(),
        '#color' => '',
        '#data' =>  array_map('intval', explode(',', $serie_entity->field_chart_series_data->getString())),
      ];
    }
    $variables['my_cool_chart']['#stacking'] = TRUE;
  }
  if (!empty($content['field_chart_multicolor']['#items']->getString())) {
    $variables['my_cool_chart']['#attributes']['class'][] = 'charts-multicolor';
  }
}

and then in your template, you could do something more like:

{{ my_cool_chart }}
🇺🇸United States andileco

Hi Daniela, sorry for the delay. First, thank you for making the transition!

Unless you have a custom or contrib module that extends Charts, you won't need that method. Please ensure you've run update.php or drush updatedb -y and cleared caches. What could be happening is a PHP-level cache. My hosting takes care of restarting Apache/nginx, but you may need to do that yourself, especially if you're working locally (I use Lando, and just run lando stop and lando start).

I'm assuming you're using Charts with Views. You'll still probably need to edit your view, adjust the chart settings, and save the view.

Please let me know how things go. You're welcome to DM me on Slack or send me an email through the contact form. If you can share a screenshare or something, that will help with any further debugging.

🇺🇸United States andileco

Hi @deasly - thanks for reporting this, and apologies for the disruption...we played things a little fast and loose because it seemed like there wasn't a ton of usage yet.

The use of the aliases has some usefulness, as it allows one to add the same column multiple times and to use it for different aggregation options, etc. But we definitely understand where you are coming from. I think what we're proposing is to have both the alias and the original column available so that you can still easily do what you're wanting without losing some of the benefits of the alias.

Please let us know what you think of this approach!

🇺🇸United States andileco

Setting back to active in case there are other automated fixes later.

🇺🇸United States andileco

Thanks for this fix, @nikathone!

Production build 0.71.5 2024