How to change plotly animation speed for a sunburst chart - plotly.js

I have a very simple sunburst chart with two levels of data :
var data = [{
type : "sunburst",
labels : ["A","B","B1","B2","C","C1","C2"],
ids : ["0","10000","100001","100003","20000","200001","200002"],
parents : ["","0","10000","10000","0","20000","20000"],
values : [16,11,10,1,5,3,2],
leaf : {
opacity: 0.4
},
marker : {
line: {
width: 5
}
},
branchvalues : 'total'
}];
var layout = {
margin : {
l: 0, r: 0, b: 0, t: 0
},
width : 200,
height : 200
};
Plotly.newPlot(
'sunburst-canvas',
data,
layout,
{
displaylogo: false
});
<script src="https://cdn.plot.ly/plotly-2.14.0.min.js"></script>
<div id="sunburst-canvas"></div>
Is there a way to change the speed of the animation that the library performs when clicking on the inner slices (back and forth) ?

Related

C3.js drawing lines between two different columns or data series

I have three time series which are plotted on the same graph using null values so that only one series is displayed for any one time, basically to get different colouring for rising and falling points.
Does anyone know how I can link the points together with lines even though they are from different series? I know with a bar chart you can use a group feature for different series to have them display on top of each other, however this doesn't seem to work for line. Here is a picture of the unconnected dots:
If you present the data to C3 as separate series with nulls where the series should not plot, then you get something like your required affect. In this snippet I have used two series - you would want a series per rising and falling set of points.
var chart = c3.generate(
{
bindto: '#chart',
size: {
width: 600,
height: 180
},
data: {
x: 'xLabels',
columns: [
['xLabels', '2015-09-17 00:00:00','2015-09-18 00:00:00','2015-09-19 00:00:00','2015-09-20 00:00:00','2015-09-21 00:00:00','2015-09-22 00:00:00','2015-09-23 00:00:00','2015-09-24 00:00:00'],
['data1', 5,10,12,17,null,null,null,null],
['data2', null,null,null,null,17,13,12,11],
['data3', null,null,null,17,17,null,null,null],
],
xFormat: '%Y-%m-%d %H:%M:%S', // ### IMPORTANT - this is how d3 understands the date formatted in the xLabels array
types: {
'data1': 'area-spline',
'data2': 'area-spline',
'data3': 'line'
},
colors: {
data3: '#cccccc'
}
},
point: {
show: true
},
legend: {
position: 'inset',
inset: {
anchor: 'top-left',
x: 20,
y: 10,
step: 2
}
},
axis: {
y: {
tick: {
format: function (d) { return d + "%"; }
}
},
x: {
type: 'timeseries',
tick: {
format: '%Y-%m-%d' // how the date is displayed
}
}
},
tooltip:{
format:{
title:function (x) { return x.getDate() + "/" + x.getMonth() + "/" + x.getFullYear() + " " + x.getHours()+ ":" + x.getMinutes() },
}
}
})
<link href="https://cdnjs.cloudflare.com/ajax/libs/c3/0.6.7/c3.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/c3/0.6.7/c3.min.js"></script>
<div class='chart-wrapper'>
<div class='chat' id="chart"></div>
</div>

how to remove the stroke or the border from the jvectormap

I want to make a dotted datagrid for the worldmap. http://prntscr.com/8oo2tw . I have used the legends(image) for every region in whole map. All seems good but when that legend lies between the boundary of the countries the legend seems to be distorted. How can i remove the stroke (boudaries between the countries) so that dotted image lying between the boundary of the countries doesnot seem distorted.
I have tried making stoke:none and stroke-width:0 and stroke-opacity:0. But doesnot seems working. My code is like:
new jvm.Map({
container: jQuery('#world-map'),
map: 'world_mill_en',
scaleColors: ['#C8EEFF', '#0071A4'],
markersSelectable: true,
hoverOpacity: 0.7,
hoverColor: false,
series: {
regions: [{
scale: {
dotted:"<?php echo $base_url .'/'. path_to_theme()?>"+"/images/dot.png",
yellowBlue: '../images/icon.png'
},
attribute: 'fill',
values: {
"AF": 'dotted',
"AX": 'dotted',
//all regions with in world_mill_en
"ZI": 'dotted',
"ZW": 'dotted',
"ZM": 'dotted',
"_1": 'dotted'
},
attribute: 'fill',
}]
},
});
You could set this parameter in a map object, like this:
regionStyle : {
initial : {
fill : "white",
"fill-opacity" : 1,
stroke : "black",
"stroke-width" : 0.0,
"stroke-opacity" : 1
},
hover : {
"fill-opacity": 1,
"stroke-width" : 0.0,
},
selectedHover : {}
},

D3.remove() is not working properly with c3-axis (I don't want to hide it)

I must remove the elements for the axis because I don't want to have empty space. I have to fit the graph in a panel.
I'm trying something like:
d3.select("g.c3-axis .c3-axis-y").remove();
d3.select("g.c3-axis-x").remove();
I printed this following selection in my console and it's all right but the remove doesn't work:
d3.select("svg").select(".c3-axis-x").selectAll("*").remove();
No results! What's the mistake ? I think that when I launch the function the chart is not completely generated, but I can't find a good solution to achieve the style desiderated.
I achieved the result in a different way, I fixed the padding for the axis in the chart.
axis:
{
x:
{
type: 'timeseries',
tick:
{
format : "%d-%m-%y"
},
show: false,
padding :
{
bottom : 0,
left: 0,
right: 0
}
},
y:
{
min: 0,
padding :
{
bottom : 0,
left: 0,
right: 0
},
tick:
{
values: [[0], [maxs]],
format: function (d) { return d3.format(',f')(d) +' kWh/h' }
},
show: false
}
},

Area Renderer (Rickshaw)

I am very new in rickshaw graphics, I have this graph
var graph = new Rickshaw.Graph( {
element: document.getElementById("chart"),
width: 900,
height: 500,
renderer: 'area',
stroke: true,
series: [{
name : "uno",
data : data1
},
{
name : "dos",
data : data2
},
{
name : "tres",
data :data3
}
]
});
But the data value of the charts appear one above the other, for example if
the three "y" values are 1, the first one appears in 1, the second in 2 and the third one in 3.
Im not sure what parameters I have to change in order that the three values appears in 1.
The problem was that i had to define the unstack value to true
var graph = new Rickshaw.Graph( {
element: document.getElementById("chart"),
width: 900,
height: 500,
renderer: 'area',
unstack : true,
stroke: true,
series: [{
name : "uno",
data : data1
},
{
name : "dos",
data : data2
},
{
name : "tres",
data :data3
}
]
});

Double axis chart in jqplot

Is it possible to have double axis chart using jqplot
Can anyone please share the example for the same
It is possible.
Code example :
$(document).ready(function(){
$.jqplot('chart1', [
[54551.94,15192.79,37937.26,11417.67,11799.59,18377.53,49207.82,168235.42,16654.29,62145.78],
[132.19,2.99,6.09,50.38,1.44,4.41,25.25,3.37,68.60,2.14]
], {
seriesDefaults : {
renderer : $.jqplot.BarRenderer,
rendererOptions : {
highlightMouseOver : true,
barWidth : 10
}
},
legend : {
show : true,
placement : 'outsideGrid'
},
axes : {
xaxis : {
renderer : $.jqplot.CategoryAxisRenderer,
tickOptions : {
angle : 45
},
ticks : ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']
},
yaxis : {
label : 'axis1',
renderer : $.jqplot.LogAxisRenderer
},
y2axis : {
label : 'axis2'
}
},
series : [{
yaxis : 'yaxis',
label : 'dataForAxis1'
}, {
yaxis : 'y2axis',
label : 'dataForAxis2'
}]
});
});
JSFiddle example :
EXAMPLE
Documentation :
See here for the reference.
Look the third example from the top.
Yes it is possible. A starting example can be :
var yaxis_data = [1,2,3,4];
var y2axis_data = [2,4,6];
var myjqplot = $.jqplot('chart1', [yaxis_data, y2axis_data], {
series: [
{ yaxis: "yaxis" },
{ yaxis: "y2axis" }
]
});
Edit : See here for further explanations about Series

Resources