Related
how to make my graph looks normal. I searched but I didn't find any relevant result. please help me out. my graph image
how can I make the data represent line's to normal width as they are so "thin" and also please tell me how to remove "0%" at middle of "bar"
I think because of this data my graph not showing properly. But how should pass data. Here below you can see my data
categories: [
'Energy',
'Real Estate',
'Information Technology',
'Financials',
'Healthcare',
'Consumer Discretionary',
'Materials',
'Communication Services',
'Industrials',
'Consumer Staples',
'Utilities',
],
series: [{
name: 'Energy',
data: [59.8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
color: '#385723',
width: 6,
dataLabels: {
color: '#385723',
},
}, {
name: 'Real Estate',
data: [0, 56.4, 0, 0, 0, 0, 0, 0, 0, 0, 0],
color: '#385723',
dataLabels: {
color: '#385723',
},
}, {
name: 'Information Technology',
data: [0, 0, 37.1, 0, 0, 0, 0, 0, 0, 0, 0],
color: '#548235',
dataLabels: {
color: '#548235',
},
}, {
name: 'Financials',
data: [0, 0, 0, 35.1, 0, 0, 0, 0, 0, 0, 0],
color: '#548235',
dataLabels: {
color: '#548235',
},
}, {
name: 'Healthcare',
data: [0, 0, 0, 0, 26.9, 0, 0, 0, 0, 0, 0],
color: '#548235',
dataLabels: {
color: '#548235',
},
}, {
name: 'Consumer Discretionary',
data: [0, 0, 0, 0, 0, 21.7, 0, 0, 0, 0, 0],
color: '#548235',
dataLabels: {
color: '#548235',
},
}, {
name: 'Materials',
data: [0, 0, 0, 0, 0, 0, 13.7, 0, 0, 0, 0],
color: '#548235',
dataLabels: {
color: '#548235',
},
}, {
name: 'Communication Services',
data: [0, 0, 0, 0, 0, 0, 0, 7.8, 0, 0, 0],
color: '#A9D18E',
dataLabels: {
color: '#A9D18E',
},
}, {
name: 'Industrials',
data: [0, 0, 0, 0, 0, 0, 0, 0, 6.4, 0, 0],
color: '#C5E0B4',
dataLabels: {
color: '#C5E0B4',
},
}, {
name: 'Consumer Staples',
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, -1.2, 0],
color: '#F8CBAD',
dataLabels: {
color: '#F8CBAD',
},
}, {
name: 'Utilities',
data: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2.5],
color: '#F4B183',
dataLabels: {
color: '#F4B183',
},
},
],
You need to disable grouping:
plotOptions: {
series: {
grouping: false
}
}
Live demo: http://jsfiddle.net/BlackLabel/osvje9uz/
API Reference: https://api.highcharts.com/highcharts/plotOptions.bar.grouping
I would like to create a regression where the dependent variable is the HHI and the independent variable is the organisational design of several companies. However, my data set is created so that I have 10 different variables for each of these, for each year (i.e. HHI_2000, HHI_2001,..)
I would like to do only one regression that takes into account all of them. Is that possible, or would I have to create a new model for every year?
This is what I did so far, for each year.
linearMod <- lm(HHI_2000 ~ org_d_2000 , data=data)
Below you can see a simplified example of my data
data <- structure(list(org_d_2000 = c(6, 5, 3, 0, 0, 0, 0, 0, 0, 0),
org_d_2001 = c(0, 0, 0, 2, 5, 6, 0, 0, 0, 0),
org_d_2002 = c(0, 0, 0, 0, 0, 0, 3, 4, 0, 0),
org_d_2003 = c(0, 0, 0, 0, 0, 0, 0, 0, 3, 2),
HHI_2000 = c(500, 444.4, 300, 0, 0, 0, 0, 0, 0, 0),
HHI_2001 = c(330, 240, 280 , 380, 400, 600, 0, 0, 0, 0),
HHI_2002 = c(278, 140, 260 , 260, 350, 580, 700, 650, 0, 0),
HHI_2003 = c(210, 90, 200 , 190, 300, 540, 780, 630, 500, 430),
release_year = c(2000, 2000, 2000, 2001, 2001, 2001, 2002,
2002, 2003, 2003)),
row.names = c(NA, 10L), class = "data.frame")
Thank you for your help.
I'm working with Fabric to create Radial-gradient like this
It can create very easily by css. Like this
<!DOCTYPE html>
<html>
<head>
<style>
#grad1 {
width: 100px;
height: 100px;
border-radius: 50%;
background: radial-gradient(ellipse at center, #1e5799 0%,rgba(255, 255, 255, 0) 100%);
}
</style>
</head>
<body>
<h3>Radial Gradient - Evenly Spaced Color Stops</h3>
<div id="grad1"></div>
<p><strong>Note:</strong> Internet Explorer 9 and earlier versions do not support gradients.</p>
</body>
</html>
But seem fabricJS do not support it. It only support gradient from side to side (?)
Does anyone work with this before. Please give me support.
Thank you
Yes
Some example: http://jsfiddle.net/fabricjs/58y8b/
// initialize fabric canvas and assign to global windows object for debug
var canvas = window._canvas = new fabric.Canvas('c');
// Do some initializing stuff
fabric.Object.prototype.set({
transparentCorners: false,
cornerColor: 'rgba(102,153,255,0.5)',
cornerSize: 12,
padding: 5
});
// Initialze the example
var rect1 = new fabric.Rect({
left: 100,
top: 100,
width: 100,
height: 100,
fill: '#ffda4f'
});
var rect2 = new fabric.Rect({
left: 250,
top: 100,
width: 100,
height: 100,
fill: 'rgb(111,154,211)'
});
var rect3 = new fabric.Rect({
left: 400,
top: 100,
width: 100,
height: 100,
fill: 'rgb(166,111,213)'
});
var rect4 = new fabric.Rect({
left: 100,
top: 400,
width: 100,
height: 100,
fill: '#ffda4f'
});
var rect5 = new fabric.Rect({
left: 250,
top: 400,
width: 100,
height: 100,
fill: 'rgb(111,154,211)'
});
var rect6 = new fabric.Rect({
left: 400,
top: 400,
width: 100,
height: 100,
fill: 'rgb(166,111,213)'
});
canvas.add(rect1, rect2, rect3, rect4, rect5, rect6);
/**
* setGradient linear gradients example
*/
// horizontal linear gradient
rect1.setGradient('fill', {
type: 'linear',
x1: -rect1.width / 2,
y1: 0,
x2: rect1.width / 2,
y2: 0,
colorStops: {
0: '#ffe47b',
1: 'rgb(111,154,211)'
}
});
// vertical linear gradient
rect2.setGradient('fill', {
type: 'linear',
x1: 0,
y1: -rect2.height / 2,
x2: 0,
y2: rect2.height / 2,
colorStops: {
0: '#ff4040',
1: '#e6399b'
}
});
// diagonal linear gradient
rect3.setGradient('fill', {
type: 'linear',
x1: -rect3.width / 2,
y1: -rect3.height / 2,
x2: rect3.width / 2,
y2: rect3.height / 2,
colorStops: {
0: 'rgb(166,111,213)',
0.5: 'rgba(106, 72, 215, 0.5)',
1: '#200772'
}
});
/**
* setGradient radial gradients example
*/
// radial gradient
rect4.setGradient('fill', {
type: 'radial',
r1: rect4.width / 2,
r2: 10,
x1: 0,
y1: 0,
x2: 0,
y2: 0,
colorStops: {
0: '#FF4F4F',
1: 'rgb(255, 239, 64)'
}
});
// radial gradient
rect5.setGradient('fill', {
type: 'radial',
r1: rect5.width / 2,
r2: 10,
x1: 0,
y1: 0,
x2: rect4.width / 4,
y2: rect4.height / 4,
colorStops: {
0: '#ffe47b',
0.5: 'rgb(111,154,211)',
1: 'rgb(166,111,213)'
}
});
// radial gradient
rect6.setGradient('fill', {
type: 'radial',
r1: 50,
r2: 80,
x1: 45,
y1: 45,
x2: 52,
y2: 50,
colorStops: {
0: 'rgb(155, 237, 0)',
1: 'rgba(0, 164, 128,0.4)'
}
});
canvas.renderAll();
You can do it like this:
let cir = new fabric.Circle({
left: 100,
top: 100,
radius: 30,
fill: 'rgba(0, 0, 0, 0)'
})
cir.setGradient('fill', {
type: 'radial',
r1: 30,
r2: 2,
x1: 30,
y1: 30,
x2: 30,
y2: 30,
colorStops: {
1: 'rgb(113,182,203)',
0: 'rgba(0, 0, 0, 0)'
}
});
fabricCanvas.add(cir);
fabricCanvas.renderAll();
http://jsfiddle.net/Kyashar/z6428pta/
I know this is very trivial but there is nothing in the documentation. I am using google charts treemap for monitoring something. If all the parent level rectangles are green, the distinct boxes aren't much clear because they are just divided by very thin white line. Can we customize the borders of each rectangle, like black line or increasing the width among each rectangle.
You can provide your own css, just keep in mind the chart is svg.
To change the border color, something like this should work.
rect {
stroke: black;
stroke-width: 2;
}
See following example...
google.charts.load('current', {
callback: function () {
var data = google.visualization.arrayToDataTable([
['Location', 'Parent', 'Market trade volume (size)', 'Market increase/decrease (color)'],
['Global', null, 0, 0],
['America', 'Global', 0, 0],
['Europe', 'Global', 0, 0],
['Asia', 'Global', 0, 0],
['Australia', 'Global', 0, 0],
['Africa', 'Global', 0, 0],
['Brazil', 'America', 11, 10],
['USA', 'America', 52, 31],
['Mexico', 'America', 24, 12],
['Canada', 'America', 16, -23],
['France', 'Europe', 42, -11],
['Germany', 'Europe', 31, -2],
['Sweden', 'Europe', 22, -13],
['Italy', 'Europe', 17, 4],
['UK', 'Europe', 21, -5],
['China', 'Asia', 36, 4],
['Japan', 'Asia', 20, -12],
['India', 'Asia', 40, 63],
['Laos', 'Asia', 4, 34],
['Mongolia', 'Asia', 1, -5],
['Israel', 'Asia', 12, 24],
['Iran', 'Asia', 18, 13],
['Pakistan', 'Asia', 11, -52],
['Egypt', 'Africa', 21, 0],
['S. Africa', 'Africa', 30, 43],
['Sudan', 'Africa', 12, 2],
['Congo', 'Africa', 10, 12],
['Zaire', 'Africa', 8, 10]
]);
new google.visualization.TreeMap(document.getElementById('chart_div')).draw(data, {
minColor: '#f00',
midColor: '#ddd',
maxColor: '#0d0',
headerHeight: 15,
fontColor: 'black',
showScale: true
});
},
packages:['treemap']
});
rect {
stroke: black;
stroke-width: 2;
}
<script src="https://www.gstatic.com/charts/loader.js"></script>
<div id="chart_div"></div>
How to convert this matrix into degrees?
I'm rotating a div with transform: rotate(). And I want to get the rotation value.
When I try $( icon ).css('transform'), it returns a matrix value like matrix(0, 0, 0, 0, 0, 0).
My question is how do I convert the matrix value into degree value?
This is what I've found:
0° matrix( 0, 0, 0, 0, 0, 0)
45° matrix( .7, .7, -.7, .7, 0, 0)
90° matrix( 0, 1, -1, 0, 0, 0)
180° matrix( -1, 0, 0, -1, 0, 0)
270° matrix( 0, -1, 1, 0, 0, 0)
Sorry if this is more of a math question...
Without being a mathematician, you can parse the rotation angle from the style.
var style = $(el).attr('style'),
rotation = parseInt(style.substr(style.indexOf("rotate("+7));
Note: This works because jQuery modifies the style attribute. If you set the rotation in CSS initially, it won't work.