Skip to content

Duplicate scale or projection name error when using non-ASCII characters in repeat #9613

@blanchco

Description

@blanchco

Bug Description

We encountered an issue when using multiple non-ASCII characters (e.g., greek letters) in the repeat function in Vega-Lite. The error shown is:

This seems to happen when the encoding generates internal names that are not sufficiently distinct, likely due to normalization or stripping of special characters.

Here is an example where I am selecting ["γ", "β"] two non-ascii characters in the repeat.
The error show is:
Duplicate scale or projection name: "child__row__column___x"

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "repeat": {"row": ["γ", "β"], "column": ["γ", "β"]},
  "data": {
    "values": [
      {
        "β": 0.8,
        "γ": 0.3,
        "S": 0.3
      },
      {
        "β": 0.6,
        "γ": 0.2,
        "S": 0.2
      },
      {
        "β": 0.7,
        "γ": 0.1,
        "S": 0.1
      }
    ]
  },
  "spec": {
    "width": 150,
    "height": 150,
    "mark": {"type": "point", "filled": true},
    "encoding": {
      "x": {
        "field": {"repeat": "column"},
        "type": "quantitative"
      },
      "y": {
        "field": {"repeat": "row"},
        "type": "quantitative",
        
      },
      "size": {"value": 80}
    }
  }
}
Image

Expected

Here is a working example which is showing as expected (I am using a non ascii character with an ascii one) "γ", "S".
{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "repeat": {"row": ["γ", "S"], "column": ["γ", "S"]},
  "data": {
    "values": [
      {
        "β": 0.8,
        "γ": 0.3,
        "S": 0.3
      },
      {
        "β": 0.6,
        "γ": 0.2,
        "S": 0.2
      },
      {
        "β": 0.7,
        "γ": 0.1,
        "S": 0.1
      }
    ]
  },
  "spec": {
    "width": 150,
    "height": 150,
    "mark": {"type": "point", "filled": true},
    "encoding": {
      "x": {
        "field": {"repeat": "column"},
        "type": "quantitative"
      },
      "y": {
        "field": {"repeat": "row"},
        "type": "quantitative",
        
      },
      "size": {"value": 80}
    }
  }
}
Image

Checklist

  • I checked for duplicate issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Enhancement 🎉Help WantedGood tasks for contributors (try https://github.com/vega/vega-lite/issues/1486 first)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions