Error creating charts with attachment

Created on 5 April 2022, about 3 years ago
Updated 1 February 2023, about 2 years ago

First, sorry for my english and sorry if this is not a bug ... I think yes, but ...

Problem/Motivation

When you create a chart with attachments charts (to create a chart with various series), you create a father chart and a some child chart series to combine in one (in the father). Ok, I put a example, some categories of spents (food, fuel, other, clothes) each one in one chart attachment as a serie (one of them as a father chart, of course). Each one have some "point" to create a line charts, for example, some years: 2019, 2020, 2021, 2022 So, we have a chart with a spents along the years (y axis) and some lines (series) with our categories. Ok, all right. But ... what happens if one category (for example food) have not all year (for example 2020 year)? This serie reduce in one its charts "point" and go to left in the chart all its points after this year. You understand me? I put down a capture with the bug chart and the bug solved.

Proposed resolution

I changed the code (sure improvable). I upload the file with the changes. I explain shortly. When all data chart is generated, in template_preprocess_views_view_charts I loop the chart data again. First the categories array after all categories are uniques and generated. After that, I loop the array data to look up for series with less number of data than the number of unique categories. Search the category is not present in array data and insert a cero value data for this category and this serie.
Repeat, it is improvable, sure.

Thanks.

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024