<script src="http://code.jquery.com/jquery-2.1.0.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.js"></script>
<script src="https://rawgit.com/zigfred/dimple/master/dist/dimple.v2.1.2tmp.js"></script>
<script src="http://build-master.jaspersoft.com:7980/jrs-pro-bugfix/client/visualize.js?_opt=true"></script>
<!--Provide container to render your visualization-->
<div id="container"></div>
JavaScript
visualize({
auth: {
name: "jasperadmin",
password: "jasperadmin",
organization: "organization_1"
}
}, function (v) {
report = v.report({
resource: "/public/viz/04._Product_Results_by_Store_Type_Report",
success: exportJson,
error: errorHandler
});
});
function exportJson () {
report.export({
outputFormat: "json",
//pages: "1-5"
}, function (link, request) {
request({
dataType: "json"
})
.done(parseData)
.fail(errorHandler);
}, errorHandler);
}
function parseData(data) {
//console.log("result: ", data)
drawD3Chart(data);
}
function drawD3Chart (data) {
var width = 1100,
height = 700;
var svg = dimple.newSvg("#container", width, height);
var myChart = new dimple.chart(svg, data);
myChart.setBounds(75, 30, width-90, height-70);
myChart.addMeasureAxis("x", "store_cost");
var yAxis = myChart.addCategoryAxis("y", "store_sales")
var zAxis = myChart.addMeasureAxis("z", "unit_sales");
zAxis.overrideMax = 400;
myChart.addSeries("recyclable", dimple.plot.bubble);
myChart.addLegend(180, 10, 360, 20, "right");
myChart.draw();
cleanAxis(yAxis, 30)
}
function errorHandler(error) {
console.log(error);
}
function cleanYAxis(axis) {
}
var cleanAxis = function (axis, oneInEvery) {
// This should have been called after draw, otherwise do nothing
if (axis.shapes.length > 0) {
// Leave the first label
var del = false;
// If there is an interval set
if (oneInEvery > 1) {
// Operate on all the axis text
axis.shapes.selectAll("text")
.each(function (d) {
// Remove all but the nth label
if (del % oneInEvery !== 0) {
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.