Combine Graph Fields in a view?

Created on 18 October 2023, about 1 year ago
Updated 1 December 2023, 12 months ago

Hi,

I have a taxonomy term with a Graph Field that is rendered through Highcharts. It's a graphical presentation of the terms market share, and is updated every 3 months. It works fine per term page, but I wonder if it's possible to combine them all in one graph (with Views)?

When I try to make this, Drupal complains about the graph field not being a data field.

"At least one data field must be selected in the chart configuration before this chart may be shown"

Is it possible?

๐Ÿ’ฌ Support request
Status

Postponed: needs info

Version

5.0

Component

Highcharts integration

Created by

๐Ÿ‡ง๐Ÿ‡ชBelgium fbreckx Antwerp

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • 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/C7ZZf3W

    I wonder if there is a way to combine them, and display something like this (the graph field from all terms combined):

    https://ibb.co/NnQr25y

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States andileco

    These images aren't loading for me...can you upload to Drupal.org?

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium fbreckx Antwerp
  • ๐Ÿ‡บ๐Ÿ‡ธ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 easier

    If 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
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States andileco
Production build 0.71.5 2024