CSNW / d3.compose

Compose complex, data-driven visualizations from reusable charts and components with d3
http://CSNW.github.io/d3.compose/
MIT License
698 stars 24 forks source link

Titles #5

Closed timhall closed 10 years ago

timhall commented 10 years ago

Example:

var config = {
  // ...
  // Chart title (with defaults top and no rotation)
  title: 'Chart Title' // Defaults to top with no rotation
  title: {position: 'left', title: 'Chart Title'} // Defaults to rotated -90 degrees
  title: {position: 'left', rotation: 0, title: 'Chart Title'}

  axes: {
    x: {title: 'X Axis Title'}, // Defaults to placement on axis side and rotation as-needed
    y: {title: {rotation: 0, title: 'Y Axis Title (without rotation)'}},
    secondaryY: {title: {position: 'top', title: 'Secondary Y (at top for some reason)'}}
  }
}
john-clarke commented 10 years ago

Very nice margin-re-sizing! Two suggestions (if easy to implement and after adding the 2 additional chart examples) :

  1. add (distinct) default classes to title elements so we can specify default formatting in CSS
  2. Add the size of the title to the margin-adjustment calculation
  3. allow for custom class specification for titles (perhaps just use addClass with a new class property in the config.
  4. allow for custom number formatting in the axes based on d3-format
laurenclarke commented 10 years ago

@timhall @john-clarke you guys seem to be getting into a space I did some deep thinking about at one point. It's all fuzzy now but it involved LESS, the Golden Ratio and color difference computations. The idea of keeping charts looking beautiful over continuous or discrete resizing is near-and-dear to me.