Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plots with colour dimensions need a legend #613

Closed
benjeffery opened this issue Oct 28, 2016 · 1 comment
Closed

Plots with colour dimensions need a legend #613

benjeffery opened this issue Oct 28, 2016 · 1 comment
Assignees

Comments

@benjeffery
Copy link
Member

No description provided.

@leehart leehart self-assigned this Nov 2, 2016
@benjeffery
Copy link
Member Author

scatter: {
    displayName: 'Scatter',
    dimensions: ['horizontal', 'vertical', 'colour'],
    plotlyTraces: (data) => {
      let traces = {};
      if (data.horizontal || data.vertical) {
        for (let i = 0, end = (data.horizontal || data.vertical).length; i < end; ++i) {
          let colour = data.colour ? data.colour[i] : 'rgb(0,0,0)';
          if (!traces[colour]) {
            traces[colour] = {
              x: [],
              y: [],
              marker: {
                color: colour,
              },
              type: 'scatter',
              mode: 'markers'
            };
          }
          if (data.horizontal)
            traces[colour].x.push(data.horizontal[i]);
          if (data.vertical)
          traces[colour].y.push(data.vertical[i]);
        }
      }
      return _values(traces);
    }
  }

Works for categoricals at least... for numerical you just need showscale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants