Skip to content

Commit

Permalink
FEATURE: upport for renderer: 'multi' in graphs and targets
Browse files Browse the repository at this point in the history
- must use renderer: multi in graph
- must define particular renderer: within a target
- target's alias must match similarly as for color:

- giraffe.coffee to reflect JS code changes and re-generate the giraffe.js
- newest Rickshaw and d3 is used
  • Loading branch information
Zdenek Pizl authored and root committed Feb 7, 2014
1 parent 311020b commit 2fe4357
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 10 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<script src="js/vendor/underscore-min.js"></script>
<script src="js/vendor/mustache.js"></script>
<script src="js/vendor/jquery.ba-bbq.min.js"></script>
<script src="js/vendor/d3.v2.min.js"></script>
<script src="js/vendor/d3.v3.min.js"></script>
<script src="js/vendor/rickshaw.min.js"></script>
<script src="js/vendor/Markdown.Converter.js"></script>

Expand Down
24 changes: 21 additions & 3 deletions js/giraffe.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions js/src/giraffe.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ getTargetColor = (targets, target) ->
if t.target == target or t.alias == target
return t.color

getTargetRenderer = (targets, target) ->
return unless typeof targets is 'object'
for t in targets
continue unless t.renderer
if t.target == target or t.alias == target
return t.renderer

generateGraphiteTargets = (targets) ->
# checking if single target (string) or a function
if typeof targets is "string" then return "&target=#{targets}"
Expand Down Expand Up @@ -305,8 +312,10 @@ Rickshaw.Graph.JSONP.Graphite = Rickshaw.Class.create(Rickshaw.Graph.JSONP,
color = palette.color()
else
color = getTargetColor(targets, el.target) || palette.color()
renderer = getTargetRenderer(targets, el.target) || 'line'
return {
color: color
renderer: renderer
stroke: stroke_fn(d3.rgb(color)) if stroke_fn?
name: el.target
data: rev_xy(el.datapoints)
Expand Down
4 changes: 0 additions & 4 deletions js/vendor/d3.v2.min.js

This file was deleted.

5 changes: 5 additions & 0 deletions js/vendor/d3.v3.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions js/vendor/rickshaw.min.js

Large diffs are not rendered by default.

0 comments on commit 2fe4357

Please sign in to comment.