- Issue created by @fbreckx
- ๐ฎ๐ณIndia AditiVB
Aditi Saraf โ made their first commit to this issueโs fork.
- ๐ฆ๐นAustria maxilein
I realized for C3 that a title field and a data field is required. in views fields. And then in the chart settings.
- ๐ง๐ชBelgium fbreckx Antwerp
@maxilein the problem is that the data is coming from a field that's already a Graph Field. I can't select this field as a data field. It renders as a graph, but is actually an array of values. Unfortunately, I don't have clue how to rewrite this and combine all graph fields in one.
- ๐บ๐ธUnited States andileco
@fbreckx is Graph Field a field from a contributed module? If so, can you link to it here?
In general, I would be inclined to create a chart with Views that accepts data from all the taxonomy terms, but uses contextual filters if you want to limit it to a specific term. And then use Layout Builder to place the view on the page and apply the term as the contextual filter.
- ๐ง๐ชBelgium fbreckx Antwerp
@andileco No it's not from a contributed module. Just using Charts with Highcharts to display a graph on a term page.
https://ibb.co/nMZZfKk
https://ibb.co/3RHyQM1
https://ibb.co/C7ZZf3WI wonder if there is a way to combine them, and display something like this (the graph field from all terms combined):
- ๐บ๐ธUnited States andileco
These images aren't loading for me...can you upload to Drupal.org?
- ๐บ๐ธUnited States andileco
@fbreckx - thank you, these help me a lot in understanding. I don't know how far along you are, but I would like to suggest a different route if you're open to it:
1) This involves some additional modules, the number of which depends on how you want to manage the process / what you want the user interface to be like.
2) Add the storage module ( https://www.drupal.org/project/storage โ )
3) Add a storage entity type - let's call it "data"
4) Add 4 fields: a) a taxonomy reference to the vocabulary you're wanting to show the charts on b) a year field, and c) a trimester field [I would recommend that b and c are term reference fields, but they don't have to be], and d) a value field
5) Add your data using the "data" storage entity type. If you know the feeds module, you can import it all at once from a CSV.
6) Create a View for your chart. Use a Block display. In the chart format settings, group by the "field a" mentioned above (this opens up options for selecting a color per taxonomy term). Add a contextual filter for the "field a" mentioned above - if a contextual filter is not available, show everything; if present, it will limit the results to the term provided.
7) Place the block on your term page** There are several ways to do this:
1) Layout builder (easy, built into Core)
2) Place the block in a region
3) Viewfield: https://www.drupal.org/project/viewfield โ
4) Twig in your term template (you could use something like https://www.drupal.org/project/twig_tweak โ to make it easierIf you want the data entry happening within the term/edit or term/add page, you could use a module like https://www.drupal.org/project/inline_entity_form โ and potentially add your own small custom module to ensure that the appropriate term is selected for a term/edit page.
I know this is a lot without a lot of details, but please let me know if it's helpful and where you need additional details.
- Status changed to Postponed: needs info
12 months ago 4:49pm 1 December 2023