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

Stacked bar widget #93

Closed
ivanmalagon opened this issue Jul 25, 2018 · 2 comments
Closed

Stacked bar widget #93

ivanmalagon opened this issue Jul 25, 2018 · 2 comments
Assignees
Labels
COMPONENTS 📊 A web component is involved
Milestone

Comments

@ivanmalagon
Copy link
Contributor

Mockup

image

(Y axis text should align to the left)

Props

Title
The text to show in the title

Description
The description of the histogram.

Show header
If false, title and description are not rendered.

Data
Values that will be shown in the widget.

Format:

Array of category objects
[
  {
    category: String. The name of the category i.e. each bar
    values: Object. Each key (String) comes with a numeric value
     {
        key1: value,
        key2: value,
        ...
     }
  },
  ...
]

Example:
  [
    {
      category: 'A New Hope',
      values: {
        investment: 204338075,
        revenue: 359029623
      }
    },
    {
      category: 'The Empire Strikes Back',
      values: {
        investment: 359029623,
        revenue: 236513856
      }
    }
  ]

From this property we can extract all the information needed to draw the chart:

  • We can traverse all the values and retrieve all the value keys.
  • If a category doesn't have a value key, create one with value 0.
  • For each value key, assign a color from the default palette.
  • For each value key, assign the value key as its label.

valuesInfo
Info for each value that allows to tweak its representation.
Format:

Object. Each key corresponds to a key on `data`
{
  valueKey1: {
    label: String. The text to show in the legend for this value,
    color: String. The custom color for this value.
  },
  valueKey2: ...
}

Example:
{
  investment: {
    label: 'Investment',
    color: '#FABADA'
  },
  revenue: {
    label: 'Gross Revenue',
    color: '#C00FEE'
  }
}

This property adds on top of the info gathered from data.
If a value has an entry in this object, we overwrite the label and / or color gathered from data.

showLegend
Default: true
If true, show the legend below the graph.

sortByValue
Nice to have.
Boolean. Default: false
If true, the bars are stacked sorted by value. First, the biggest.

Example:
image

showCategories
Nice to have.
Boolean. Default: false
If true the categories name will be written below each bar. This is only suitable for short strings, that's why this is optional and false by default.

Questions

  • What palette do we use by default? @CartoDB/design
@ivanmalagon ivanmalagon added the COMPONENTS 📊 A web component is involved label Jul 25, 2018
@ivanmalagon ivanmalagon mentioned this issue Jul 25, 2018
13 tasks
@ivanmalagon ivanmalagon added the BLOCKED 🛑 Can't be started label Aug 14, 2018
@ivanmalagon
Copy link
Contributor Author

This widget won't be finished during this dev cycle. Putting it off to the next one.

@ivanmalagon ivanmalagon added this to the cycle-2 milestone Aug 30, 2018
@ivanmalagon ivanmalagon removed the BLOCKED 🛑 Can't be started label Aug 30, 2018
@IagoLast IagoLast self-assigned this Oct 8, 2018
@ivanmalagon ivanmalagon modified the milestones: cycle-2, cycle-3 Oct 8, 2018
@IagoLast
Copy link
Contributor

IagoLast commented Oct 10, 2018

@ivanmalagon I got some questions:

  • What are the default colors? how are they applied?
  • Is the legend located on top or bottom?
  • What about x label? is not defined in the design but I guess we are going to need it.
    • At the moment there will not be x-label since showCategories option will be disabled

IagoLast added a commit that referenced this issue Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMPONENTS 📊 A web component is involved
Projects
None yet
Development

No branches or pull requests

2 participants