Hi All! Apologies for not seeing this earlier. I updated the merge request with some code that's worked for me on the new Apexcharts.js (drupal.org/project/charts_apexcharts) module. Please try it out and let me know if it works!
andileco → made their first commit to this issue’s fork.
andileco → created an issue.
Actually, also needs to be applied for the 5.1.x branch
Thank you - fixed!
andileco → made their first commit to this issue’s fork.
@dallen33 - please make an attempt! I would say check out how the other two filters have been implemented and then see how the combine fields filter works. I would think this module is a really good candidate for that because all the fields are text.
Hi @jitendrapurohit - can you share what's needed for the fields to be translated by TGMT?
andileco → made their first commit to this issue’s fork.
Thank you for this huge amount of work. I hope people stop using this version in favor of the 5.x branches, but it's still better to have clean code while there are some users.
andileco → made their first commit to this issue’s fork.
@bluegeek, I see this as "Needs review", but I'm not seeing any changes in the "3144014-fix-code-standards" branch.
Sorry, jumped on this one too quickly (code looked good, though). Let's make sure the tests do pass, though.
andileco → made their first commit to this issue’s fork.
andileco → made their first commit to this issue’s fork.
Thank you, @noah! I'm really sorry for that inconvenience. I enjoy working with arrays more than objects, so hopefully overall this is a more enjoyable experience.
andileco → made their first commit to this issue’s fork.
Going to apply to the 5.0.x branch.
I'm going to apply this for the 5.0.x branch as well. It's just remaining open because @mfb suggested some tests.
@tsene - I think this is an issue with the views_field_view that we inherited. Can you try applying and then edit the field configuration again to see if it works the second time?
andileco → made their first commit to this issue’s fork.
andileco → created an issue.
Thank you!
andileco → made their first commit to this issue’s fork.
I added two properties, as I think this would be more helpful for users when separated:
$chart[$key]['#view_id'] = $this->view->id();
$chart[$key]['#chart_attachment_id'] = $child_display_handler->display['id'];
andileco → made their first commit to this issue’s fork.
Thank you! Automated and manual tests passed for me.
Thank you!
andileco → made their first commit to this issue’s fork.
andileco → created an issue.
andileco → created an issue.
andileco → made their first commit to this issue’s fork.
This resolves the error for me. +1 RTBC
andileco → made their first commit to this issue’s fork.
Hi @effortdee - unfortunately, the way this specific Views field (Counter) is constructed, the value it returns is a string containing Twig: "{{ counter }}", and this gets rendered after the Views Simple Math Field has already performed its calculation. Can you instead aggregate your view and use the COUNT aggregation method and use the field you've applied that on in your Views Simple Math Field?
@zerbash - apologies, I wasn't seeing your changes when I made my patch. I'm probably fine with either - can you take a look at them and let me know your thoughts?
This was reviewed on Slack: https://drupal.slack.com/archives/C878FC7HS/p1729289428068719?thread_ts=...
andileco → made their first commit to this issue’s fork.
Thanks for the ticket and review, @ultimike, and thanks for the patch, @nikathone! Merged!
andileco → made their first commit to this issue’s fork.
andileco → created an issue.
@alokdrupl, that might just be a separate issue purely related to the "No label field"; if so, can you create a new ticket?
@dbdrupal, can you ensure that your Chart format links are italicized, like in the attached image? If they are not, it means your settings on the one display are overriding the settings on the other. To change this, click the "Chart" link and then select "This display only".
diaodiallo → credited andileco → .
andileco → created an issue.
andileco → created an issue.
andileco → made their first commit to this issue’s fork.
andileco → made their first commit to this issue’s fork.
Hi @megachriz, thanks for your thoughtful review. You see how it works, but are not understanding the value, so let me try to explain:
Let's say you need to import data from an external survey. Let's pretend have a checkboxes style question: "How did you hear about us? (check as many as apply)":
The base key for this field is "referral", but there's no referral column with all the selections. Instead, each value option has it's own column, like "referral__a":
When you import the data into your entity type, you're wanting it to go into a single, unlimited cardinality entityreference field:
In this case, you would add a second tamper to explode the value generated by this tamper.
Does that explain a little better the use-case for this?
nikathone → credited andileco → .
andileco → created an issue.
@jackfoust can you try this instead and report back? https://git.drupalcode.org/project/views_csv_source/-/merge_requests/9/d...
@jackfoust - we've been unable to recreate this error. Can you export your view and send a dummy CSV file (not real data) so that we can try to recreate it?
andileco → made their first commit to this issue’s fork.
Thank you! The select filter will be a great feature for users!
You need to use the "Chart attachment" feature in views. You can enable drupal/views_csv_source, upload the attached CSV*, and then import the following. You'll need to edit the "Query" part of the View to ensure it's pointing to the CSV on your local server.
*(actually I can't upload a CSV, but here's a screenshot of what it looks like)
uuid: d8c2283c-9872-47d1-b4c9-9d58aa6b2395
langcode: en
status: true
dependencies:
module:
- charts
- charts_highcharts
- views_csv_source
id: population_and_growth_rate
label: 'Population and Growth Rate'
module: views
description: ''
tag: ''
base_table: csv
base_field: ''
display:
default:
id: default
display_title: Default
display_plugin: default
position: 0
display_options:
title: 'Population and Growth Rate'
fields:
value:
id: value
table: csv
field: value
relationship: none
group_type: group
admin_label: ''
entity_type: null
entity_field: null
plugin_id: views_csv_source_field
label: Year
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
key: Year
trusted_html: 0
value_1:
id: value_1
table: csv
field: value
relationship: none
group_type: group
admin_label: ''
plugin_id: views_csv_source_field
label: Population
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
key: Population
trusted_html: 0
pager:
type: mini
options:
offset: 0
pagination_heading_level: h4
items_per_page: 10
total_pages: null
id: 0
tags:
next: ››
previous: ‹‹
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
access:
type: none
options: { }
cache:
type: tag
options: { }
empty: { }
sorts: { }
arguments: { }
filters: { }
style:
type: chart
options:
grouping: { }
chart_settings:
library: highcharts
type: column
fields:
label: value
stacking: false
data_providers:
value:
enabled: false
color: '#006fb0'
weight: 2
value_1:
enabled: true
color: '#205fe0'
weight: 2
display:
title: 'Population and Growth Rate Combo Chart'
title_position: out
subtitle: ''
data_labels: false
data_markers: false
legend_position: bottom
background: ''
three_dimensional: 0
polar: 0
tooltips: true
dimensions:
width: ''
width_units: '%'
height: ''
height_units: ''
gauge:
max: '100'
min: '0'
green_from: '85'
green_to: '100'
yellow_from: '50'
yellow_to: '85'
red_from: '0'
red_to: '50'
color_changer: false
xaxis:
title: Year
labels_rotation: '0'
yaxis:
title: Population
min: ''
max: ''
prefix: ''
suffix: ''
decimal_count: ''
labels_rotation: '0'
row:
type: fields
query:
type: views_query
options:
csv_file: 'internal:/sites/default/files/2024-09/Population-GrowthRate.csv'
headers: ''
request_method: get
request_body: ''
show_errors: 1
relationships: { }
header: { }
footer: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url.query_args
tags: { }
chart_extension_1:
id: chart_extension_1
display_title: 'Chart attachment'
display_plugin: chart_extension
position: 2
display_options:
fields:
value:
id: value
table: csv
field: value
relationship: none
group_type: group
admin_label: ''
entity_type: null
entity_field: null
plugin_id: views_csv_source_field
label: Year
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
key: Year
trusted_html: 0
value_1:
id: value_1
table: csv
field: value
relationship: none
group_type: group
admin_label: ''
plugin_id: views_csv_source_field
label: 'Growth Rate'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
key: 'Growth rate'
trusted_html: 0
style:
type: chart
options:
grouping: { }
chart_settings:
library: highcharts
type: line
fields:
label: value
stacking: false
data_providers:
value:
enabled: false
color: '#006fb0'
weight: 2
value_1:
enabled: true
color: '#e01527'
weight: 2
display:
title: ''
title_position: out
subtitle: ''
data_labels: false
data_markers: false
legend_position: right
background: ''
three_dimensional: 0
polar: 0
tooltips: true
dimensions:
width: ''
width_units: '%'
height: ''
height_units: ''
gauge:
max: '100'
min: '0'
green_from: '85'
green_to: '100'
yellow_from: '50'
yellow_to: '85'
red_from: '0'
red_to: '50'
color_changer: false
xaxis:
title: ''
labels_rotation: '0'
yaxis:
title: 'Growth Rate'
min: ''
max: ''
prefix: ''
suffix: '%'
decimal_count: ''
labels_rotation: '0'
defaults:
fields: false
display_extenders: { }
displays:
page_1: page_1
inherit_yaxis: '0'
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
tags: { }
page_1:
id: page_1
display_title: Page
display_plugin: page
position: 1
display_options:
display_extenders: { }
path: population-and-growth-rate
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url.query_args
tags: { }
Thank you! Some custom code went into this page for sure, but I think most of the features you're looking for are just part of the Highcharts Stock (formerly Highstock) library (https://www.highcharts.com/products/stock/ - requires a license). We did end up building a Charts submodule to enable you to use this library in your site:
https://www.drupal.org/project/charts_highstock →
If you haven't already explored https://www.drupal.org/project/views_csv_source → , that's also worth trying. This could have substituted for some of the code we used to get the stringency data.
Please let me know if this gives you enough info to close this ticket.
It would be a huge contribution if you could outline/model what that might look like. I would love to work towards something like that.
We have created ways for users to build their own charts through exposed filters (https://hub.tbdiah.org/data-explorer/indicators), but don't necessarily have a great way to store those generated charts.
So the following doesn't get you away from using Views, but both Views CSV Source (that my colleague and I built) and Views JSON Source can be combined with Views.
Here's more about Views CSV Source: https://www.thedroptimes.com/41889/streamlining-data-integration-with-vi...
I think aggregation should handle that for you. Try creating the data for your chart as a Table display, then switch to the Chart display.
Sorry, I was referring to the "Grouping field" in the Chart configuration. You are grouping by year. That shouldn't be necessary as far as I can tell.
Thanks for this and your documentation request (will try to get to it soon). The issue is that the way we designed the Grouping is to make each item with a different name its own series, hence the line not connecting. Do you need to group for that view? Could you use Stacking instead?
I've created a patch that accomplishes some of this (enough for my needs at this point), but only for the ViewsYearFilterDateTime filter plugin class. Some things that are still needed (there are probably other things too):
- config/schema file
- add (and test) changes on other filter plugins
andileco → made their first commit to this issue’s fork.