Related
I'm trynna make a scratch code of Semantic segmentation through U-Net. I'll use Cityscapes Dataset. I'm trying to make a dictionary(python) composed of the key(car, train, human, etc) and the value(rgb info). How can I match the dictionary with my ground_truth data?
example of labeling dictionary is like below
color_map = {
'0': [0, 0, 0], # unlabelled
'1': [128, 64, 128], # road
'2': [244, 35, 232], # sidewalk
'3': [70, 70, 70], # building
'4': [102, 102, 156], # wall
'5': [190, 153, 153], # fence
'6': [153, 153, 153], # pole
'7': [250,170, 30], # traffic_light
'8': [220, 220, 0], # traffic_sign
'9': [107, 142, 35], # vegetation
'10': [152, 251, 152], # terrain
'11': [0, 130, 180], # sky
'12': [220, 20, 60], # person
'13': [255, 0, 0], # rider
'14': [0, 0, 142], # car
'15': [0, 0, 70], # truck
'16': [0, 60, 100], # bus
'17': [0, 80, 100], # train
'18': [0, 0, 230], # motorcycle
'19': [119, 11, 32] # bicycle
}
I am using basic line Highcharts on my Angular 8 project. While I'm trying to use the system on the iPhone I can't scroll the page over the area where a chart is lying. Chart is preventing page scrolling from working. This is very annoying for instance when a chart is covering the whole screen, as there's no way to scroll the page in this case.
I am adding a code of my TS function
chartOptions = {
title: {
text: 'Your Net Worth'
},
yAxis: {
title: {
text: 'Money in GBP'
}
},
legend: {
align: 'center',
verticalAlign: 'bottom',
x: 0,
y: 0
},
credits: {
enabled: false,
},
plotOptions: {
series: {
label: {
connectorAllowed: false
},
pointStart: 2020
}
},
series: [
{
name: 'Net Worth',
color: '#00b300',
data: [latest_networth_for_chart]
}
, {
name: 'Age group (domestic) (coming soon)',
color: '#ff0000',
data: [0, 0, 0, 0, 0, 0, 0, 0],
visible: false
}, {
name: 'Age group (expats) (coming soon)',
color: '#0000b3',
data: [0, 0, 0, 0, 0, 0, 0, 0],
visible: false
},
{
name: 'Others in your industry (coming soon)',
color: '#0000b3',
data: [0, 0, 0, 0, 0, 0, 0, 0],
visible: false
},
{
name: 'Peer group (coming soon)',
color: '#0000b3',
data: [0, 0, 0, 0, 0, 0, 0, 0],
visible: false
},
{
name: 'Global average (coming soon)',
color: '#0000b3',
data: [0, 0, 0, 0, 0, 0, 0, 0],
visible: false
},
{
name: 'This time last year (coming soon)',
color: '#0000b3',
data: [0, 0, 0, 0, 0, 0, 0, 0],
visible: false
},
],
responsive: {
rules: [{
condition: {
maxWidth: 540
},
chartOptions: {
legend: {
layout: 'horizontal',
align: 'center',
verticalAlign: 'bottom',
enabled: false
}
}
}]
}
}
}
Am I did anything wring on my code?
Regarts, Faz.
I am new to using highcharts.js. I want to create an activity gauge chart using data from a json file or url. I have understood how they draw the chart but failed to understand the data format used in json to display the chart.
Here is my code
var options = {
chart: {
type: 'solidgauge',
marginTop: 50
},
title: {
text: 'Activity',
style: {
fontSize: '24px'
}
},
tooltip: {
borderWidth: 0,
backgroundColor: 'none',
shadow: false,
style: {
fontSize: '16px'
},
pointFormat: '{series.name}<br><span style="font-size:2em; color: {point.color}; font-weight: bold">{point.y}%</span>',
positioner: function (labelWidth, labelHeight) {
return {
x: 200 - labelWidth / 2,
y: 180
};
}
},
pane: {
startAngle: 0,
endAngle: 360,
background: [{ // Track for Move
outerRadius: '112%',
innerRadius: '88%',
backgroundColor: Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0.3).get(),
borderWidth: 0
}, { // Track for Exercise
outerRadius: '87%',
innerRadius: '63%',
backgroundColor: Highcharts.Color(Highcharts.getOptions().colors[1]).setOpacity(0.3).get(),
borderWidth: 0
}, { // Track for Stand
outerRadius: '62%',
innerRadius: '38%',
backgroundColor: Highcharts.Color(Highcharts.getOptions().colors[2]).setOpacity(0.3).get(),
borderWidth: 0
}]
},
yAxis: {
min: 0,
max: 100,
lineWidth: 0,
tickPositions: []
},
plotOptions: {
solidgauge: {
borderWidth: '34px',
dataLabels: {
enabled: false
},
linecap: 'round',
stickyTracking: false
}
},
series: []
};
var gauge1;
$.getJSON('bryan.json', function(json){
console.log(json)
options.chart.renderTo = 'container';
options.series.data = json
gauge1 = new Highcharts.Chart(options);
});
/**
* In the chart load callback, add icons on top of the circular shapes
*/
function callback()
{
// Move icon
this.renderer.path(['M', -8, 0, 'L', 8, 0, 'M', 0, -8, 'L', 8, 0, 0, 8])
.attr({
'stroke': '#ffffff',
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'stroke-width': 2,
'zIndex': 10
})
.translate(190, 26)
.add(this.series[2].group);
// Exercise icon
this.renderer.path(['M', -8, 0, 'L', 8, 0, 'M', 0, -8, 'L', 8, 0, 0, 8, 'M', 8, -8, 'L', 16, 0, 8, 8])
.attr({
'stroke': '#ffffff',
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'stroke-width': 2,
'zIndex': 10
})
.translate(190, 61)
.add(this.series[2].group);
// Stand icon
this.renderer.path(['M', 0, 8, 'L', 0, -8, 'M', -8, 0, 'L', 0, -8, 8, 0])
.attr({
'stroke': '#ffffff',
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'stroke-width': 2,
'zIndex': 10
})
.translate(190, 96)
.add(this.series[2].group);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="container" style="width: 400px; height: 400px; margin: 0 auto">
</div>
And here is my json data which i thout might be rendered but it didnot.
data.json
First of all, instead of options.series.data = json, you need to create the first series and then populate its data array with your data. Also, set in each point different radius and innerRadius properties. Take a look at the example below.
API Reference:
http://api.highcharts.com/highcharts/series.solidgauge.data.radius
http://api.highcharts.com/highcharts/series.solidgauge.data.innerRadius
Example:
http://jsfiddle.net/x3cne1ng/
I'm trying to create a single-line graph using highcharts.js, which has a treshold of 100 and is multi-color. For numbers above 100 the line is red, and for numbers less that 100 the line should get blue. I'd like to have something the same as picture. any thoughts? If there's a solution with another library, I appreciate it.
You can use bar chart and colour it with a gradient, which is dynamically generated based on your data.
const data = [50, 95, 124, 78, 60, 108, 108, 120, 155, 87, 57, 76]
const colors = Highcharts.getOptions().colors
const options = {
plotOptions: {
bar: {
pointWidth: 10
}
},
tooltip: {
enabled: false
},
series: [{
color: {
linearGradient: {
x1: 0,
x2: 0,
y1: 0,
y2: 1
},
stops: data.map((v, i) => {
return [
i/data.length, v > 100 ? colors[5] : colors[0]
]
})
},
data: [100],
type: 'bar'
}]
}
const chart = Highcharts.chart('container', options)
Live example: https://jsfiddle.net/cn3aj3jd/
Output:
I need to have a bubble layout like this:
I have completed the work till this stage - JsBin
As I am not that skilled in CSS/Web design, I can only think of using table tr td.
But I can see I will need the bubbles to be aligned close to each other. If I go for table structure, I dont think it will work.
Please suggest some design structure, or I should go for other things, SVG, etc.
Thanks!
I hope this helps you :) I have fun with this.
(Also check out this for some great reading / viewing http://paulbourke.net/texture_colour/randomtile/)
Demo: http://po0.co.uk/circles/
Uses: http://packery.metafizzy.co/
Code:
<style>
.circle
{
border-radius:50%;
text-align:center;
background:#efdeee;
display:inline-block;
margin:-5px;
}
</style>
<div id="container">
<?php
$xx = 1;
while ($xx <= 200) {
$thisx = rand(10,99);
echo '<div class="item circle" style="width:'.$thisx.'px;height:'.$thisx.'px;"> </div>';
$xx++;
}
?>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/packery/1.4.1/packery.pkgd.min.js"></script>
<script>
var container = document.querySelector('#container');
var pckry = new Packery( container, {
// options
itemSelector: '.item',
gutter: 10
});
</script>
You can also try with the HTML5 canvas feature. Here you can learn more about CANVAS.
Please visit the FiddleDemo.
HTML
<canvas width="400" height="400" id="circles"></canvas>
Javascript
var circle = $('#circles').get(0).getContext('2d');
var circles = [
{ x: 50, y: 50, r: 25, c: "#78BA00" },
{ x: 80, y: 100, r: 35, c: "#F4B300" },
{ x: 150, y: 170, r: 15, c: "#78BA00" },
{ x: 50, y: 220, r: 20, c: "#F4B300" },
{ x: 60, y: 150, r: 10, c: "#78BA00" },
{ x: 70, y: 170, r: 15, c: "#F4B300" },
{ x: 110, y: 220, r: 16, c: "#78BA00" },
{ x: 130, y: 150, r: 2, c: "#F4B300" },
{ x: 60, y: 150, r: 5, c: "#78BA00" },
{ x: 70, y: 170, r: 12, c: "#F4B300" },
{ x: 110, y: 30, r: 21, c: "#78BA00" },
{ x: 180, y: 60, r: 2, c: "#F4B300" },
{ x: 70, y: 90, r: 21, c: "#78BA00" },
{ x: 220, y: 110, r: 2, c: "#F4B300" }
];
function drawCircle(data) {
circle.beginPath();
circle.arc(data.x, data.y, data.r, 0, Math.PI * 2);
circle.fillStyle = data.c;
circle.fill();
}
$.each(circles, function() {
drawCircle(this);
});
Explanation of { x: 50, y: 50, r: 25, c: "#78BA00" },
x : x-axis postion in pixels
y : y-axis position in pixels
r : radius in pixels
c : mention the color in hex
With the help of above parameters you can Position, Size and Color the circles as per your needs.
Most importantly this solution will be independent of server-side scripting.