enwida / idpRepo

idp code repository
1 stars 1 forks source link

Move chart color definitions to navigation JSON #24

Closed dsmatter closed 11 years ago

dsmatter commented 11 years ago

Defining colors via CSS doesn't go along with chart (SVG) download because CSS rules which apply to parents of the SVG element can't be reflected in the stripped out SVG file.

Example:

CSS:

.line {
  stroke: red;
}
.chart[data-type="minmax"] .line {
  stroke: green
}

HTML:

<div class="chart" data-type="minmax">
  <svg>
    <line class="line" />
  </svg>
</div>

The line will be drawn green in the website but red if we strip out the SVG element and append the stylesheet.

dsmatter commented 11 years ago

Solved the issue by propagating data-* attributes down to the SVG element.