Visitar URL original
[Feature] After jitter is set for the scatter points, the scatter points are displayed with fixed coordinates. · Issue #21753 · apache/echarts · GitHub
Skip to content

[Feature] After jitter is set for the scatter points, the scatter points are displayed with fixed coordinates. #21753

Description

@wydsjyoung

What problem does this feature solve?

The current scenario involves the same set of scatter data. Each time the setOption method is executed, the distribution position of the scatter points in the chart changes. It is hoped that a configuration can be provided to ensure that the coordinate positions of the scatter points do not change when the data remains unchanged.

What does the proposed API look like?

The configuration mode is the same as that of jitter.

Activity

  1. added
    enThis issue is in English
    pendingWe are not sure about whether this is a bug/new feature.
    on Sep 16, 2026
  2. plainheart commented on Sep 16, 2026

    @plainheart
    Member

    This makes sense. To achieve deterministic jitter layout when data remains unchanged, we could introduce a way to configure a custom random number generator or a random seed.

    How about adding options like jitterRng (or jitterRandom) to the configuration?

    Here is a quick conceptual example using a seeded random generator (like seedrandom):

    The usage is like this,

    <script src="https://cdnjs.cloudflare.com/ajax/libs/seedrandom/3.0.5/seedrandom.min.js"></script>
    <script>
    const option = {
      // ...
      xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
        jitter: (width / 7) * 0.8,
        // Accept a custom RNG function
        jitterRng: new Math.seedrandom('jitter'),
      },
      // ...
    }
    </script>

    WDYT? @100pah @Ovilia @wydsjyoung

    The proposed changes for this feature are available at 02eddda .

  3. pinned and unpinned a comment on Sep 16, 2026
  4. wydsjyoung commented on Sep 18, 2026

    @wydsjyoung
    Author

    @plainheart Thanks for the design.
    I understand jitterRng accepts a custom RNG function returning [0,1), matching the signature of Math.random().
    Two possible approaches:

    1. Use seedrandom library as shown in the example.
    2. Implement a simple LCG RNG without external dependencies.

    The design looks flexible, and I have no objection to it.

    One concern: this may add extra work for ordinary users. Anyone wanting stable jitter positions would need to add an external library or write their own RNG.
    Could we add a shorthand jitterSeed option?
    If jitterSeed is set, ECharts uses its built-in seeded RNG automatically for most users, while keeping jitterRng as the advanced custom override.

    This is just a suggestion.
    Looking forward to this feature.

  5. plainheart commented on Sep 28, 2026

    @plainheart
    Member

    Hi, @wydsjyoung, thanks for your suggestion. I agree that adding a built-in seeded RNG is easier to use for most users. I just opened PR #21765 with the proposed implementation. Feel free to review and leave your comments!

  6. removed
    pendingWe are not sure about whether this is a bug/new feature.
    on Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions