Skip to content

Instantly share code, notes, and snippets.

@aaizemberg
Created December 1, 2017 15:22
Show Gist options
  • Save aaizemberg/94d435e4e3c591f3585c2ee3eb9b68b0 to your computer and use it in GitHub Desktop.
Save aaizemberg/94d435e4e3c591f3585c2ee3eb9b68b0 to your computer and use it in GitHub Desktop.
dimple pie chart con colores mas lindos
<!DOCTYPE html>
<meta charset="utf-8">
<div id="chartContainer"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.2.3/d3.min.js"></script>
<script src="http://dimplejs.org/dist/dimple.v2.3.0.min.js"></script>
<script>
var svg = dimple.newSvg("#chartContainer", 600, 400);
d3.tsv("https://raw.githubusercontent.com/aaizemberg/vis/gh-pages/graduados/data.tsv", function (data) {
var myChart = new dimple.chart(svg, data);
myChart = new dimple.chart(svg, data);
myChart.setBounds(20, 20, 460, 360)
myChart.addMeasureAxis("p", "cant");
myChart.addSeries("titulo", dimple.plot.pie);
myChart.addLegend(440, 20, 90, 300, "left");
myChart.defaultColors = [
new dimple.color(d3.schemeCategory20[0], "white"),
new dimple.color(d3.schemeCategory20[1], "white"),
new dimple.color(d3.schemeCategory20[2], "white"),
new dimple.color(d3.schemeCategory20[3], "white"),
new dimple.color(d3.schemeCategory20[4], "white"),
new dimple.color(d3.schemeCategory20[5], "white"),
new dimple.color(d3.schemeCategory20[6], "white"),
new dimple.color(d3.schemeCategory20[7], "white"),
new dimple.color(d3.schemeCategory20[8], "white"),
new dimple.color(d3.schemeCategory20[9], "white"),
new dimple.color(d3.schemeCategory20[10], "white"),
new dimple.color(d3.schemeCategory20[11], "white"),
new dimple.color(d3.schemeCategory20[12], "white"),
new dimple.color(d3.schemeCategory20[13], "white"),
new dimple.color(d3.schemeCategory20[14], "white"),
new dimple.color(d3.schemeCategory20[15], "white")
];
myChart.draw();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment