How to make a chart with 2 data series and with 2 type of charts?

Created on 6 September 2024, 5 months ago

In MS excel, as the screenshot below I can make a charts with 2 data series, each in a different chart type( i.e. Column and Line):

How make it with the charts module?

Also attached the Excel file for your test.

πŸ’¬ Support request
Status

Active

Version

5.1

Component

Chart API

Created by

πŸ‡¨πŸ‡³China fishfree

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

Comments & Activities

  • Issue created by @fishfree
  • πŸ‡ΊπŸ‡ΈUnited States andileco

    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: {  }
    
    
  • πŸ‡¨πŸ‡³China fishfree

    @andileco Thank you very much! It works!

Production build 0.71.5 2024