Skip to content

[charts] Improve axis grouping logic #19067

@JCQuintas

Description

@JCQuintas

You mapped the new groups structure to generate getGrouping and keep this internal logic. BU tit might be simpler to directly use groups

const maxGroupIndex = groups.length -1

const allTickItems = []

for (let groupIndex = 0; groupIndex < groups.length; groupIndex+=1){
  // No need to sort anymore

  tickValues.forEach((tickValue, dataIndex) => {
    const groupValue = groups[groupIndex].getValue(tickValue, dataIndex);

    // ....

    if(isNew){
      // Add a new item
      allTickItems.push( ... )
    } else {
      // Merge it with the last item
      allTickItems[allTickItems.length -1].size += itemSize
    }
  })
}

Originally posted by @alexfauquette in #18766 (comment)

Metadata

Metadata

Assignees

Labels

scope: chartsChanges related to the charts.type: enhancementIt’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions