HPCC Palettes
Last active
February 4, 2016 17:39
-
-
Save GordonSmith/8aeb5d704fa014f7260e to your computer and use it in GitHub Desktop.
Custom Ordinal Palette
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<script src="http://viz.hpccsystems.com/v1.8.4/dist-amd-src/hpcc-viz.js"></script> | |
<script src="http://viz.hpccsystems.com/v1.8.4/dist-amd-src/hpcc-bundles.js"></script> | |
<script> | |
require.config({ | |
paths: { | |
"src": "http://viz.hpccsystems.com/v1.8.4/dist-amd-src", | |
"font-awesome": "http://viz.hpccsystems.com/v1.8.4/dist-amd-src/font-awesome/css/font-awesome.min" | |
} | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="placeholder" style="width:100%; height:100vh"> | |
</div> | |
<script> | |
require(["src/chart/Pie", "src/common/Palette"], function (Pie, Palette) { | |
var newPal = Palette.ordinal("RBI", ["green", "antiquewhite", "navy", "red"]); | |
// If you want to force a colour to a known value, just request them in order after creation: | |
newPal("Ireland"); //Green | |
newPal("England"); //white | |
newPal("Scotland"); //navy | |
newPal("Wales"); //red | |
var widget = new Pie() | |
.target("placeholder") | |
.paletteID("RBI") | |
.columns(["Location", "Score"]) | |
.data([["England", 22], ["Wales", 88], ["Scotland", 88], ["Ireland", 88]]) | |
.render() | |
; | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment