Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 620e8cd

Browse files
author
mahdis-z
committed
Revert "old gauge docs were removed"
This partially reverts commit c5bb50b. new file: _posts/plotly_js/basic/gauge/2015-12-20-basic-gauge.html new file: _posts/plotly_js/basic/gauge/2015-12-20-gauge-chart_plotly_js_index.html
1 parent c5bb50b commit 620e8cd

12 files changed

+205
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
name: Circular Gauge Chart
3+
plot_url: https://codepen.io/plotly/embed/rxeZME/?height=600&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: gauge-charts
6+
order: 1
7+
sitemap: false
8+
arrangement: horizontal
9+
---
10+
// Enter a speed between 0 and 180
11+
var level = 175;
12+
13+
// Trig to calc meter point
14+
var degrees = 180 - level,
15+
radius = .5;
16+
var radians = degrees * Math.PI / 180;
17+
var x = radius * Math.cos(radians);
18+
var y = radius * Math.sin(radians);
19+
20+
// Path: may have to change to create a better triangle
21+
var mainPath = 'M -.0 -0.025 L .0 0.025 L ',
22+
pathX = String(x),
23+
space = ' ',
24+
pathY = String(y),
25+
pathEnd = ' Z';
26+
var path = mainPath.concat(pathX,space,pathY,pathEnd);
27+
28+
var data = [{ type: 'scatter',
29+
x: [0], y:[0],
30+
marker: {size: 28, color:'850000'},
31+
showlegend: false,
32+
name: 'speed',
33+
text: level,
34+
hoverinfo: 'text+name'},
35+
{ values: [50/6, 50/6, 50/6, 50/6, 50/6, 50/6, 50],
36+
rotation: 90,
37+
text: ['TOO FAST!', 'Pretty Fast', 'Fast', 'Average',
38+
'Slow', 'Super Slow', ''],
39+
textinfo: 'text',
40+
textposition:'inside',
41+
marker: {colors:['rgba(14, 127, 0, .5)', 'rgba(110, 154, 22, .5)',
42+
'rgba(170, 202, 42, .5)', 'rgba(202, 209, 95, .5)',
43+
'rgba(210, 206, 145, .5)', 'rgba(232, 226, 202, .5)',
44+
'rgba(255, 255, 255, 0)']},
45+
labels: ['151-180', '121-150', '91-120', '61-90', '31-60', '0-30', ''],
46+
hoverinfo: 'label',
47+
hole: .5,
48+
type: 'pie',
49+
showlegend: false
50+
}];
51+
52+
var layout = {
53+
shapes:[{
54+
type: 'path',
55+
path: path,
56+
fillcolor: '850000',
57+
line: {
58+
color: '850000'
59+
}
60+
}],
61+
title: '<b>Gauge</b> <br> Speed 0-100',
62+
height: 1000,
63+
width: 1000,
64+
xaxis: {zeroline:false, showticklabels:false,
65+
showgrid: false, range: [-1, 1]},
66+
yaxis: {zeroline:false, showticklabels:false,
67+
showgrid: false, range: [-1, 1]}
68+
};
69+
70+
Plotly.newPlot('myDiv', data, layout);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: JavaScript Graphing Library D3.js-based Gauge Charts| Examples | Plotly
3+
name: Gauge Charts
4+
permalink: javascript/gauge-charts/
5+
description: How to make a D3.js-based circular gauge chart in javascript.
6+
layout: user-guide
7+
thumbnail: thumbnail/gauge.jpg
8+
language: plotly_js
9+
has_thumbnail: true
10+
display_as: basic
11+
order: 12
12+
redirect_from: javascript-graphing-library/gauge-charts/
13+
---
14+
{% assign examples = site.posts | where:"language","plotly_js" | where:"suite","gauge-charts" | sort: "order" %}
15+
{% include auto_examples.html examples=examples %}

_posts/plotly_js/financial/gauge/2015-12-20-gauge-charts_plotly_js_index.html

Whitespace-only changes.

_posts/plotly_js/financial/gauge/2019-07-30-advance-gauge.html

Whitespace-only changes.

_posts/plotly_js/financial/gauge/2019-07-30-basic-gauge.html

Whitespace-only changes.

_posts/plotly_js/financial/gauge/2019-07-30-custom-gauge.html

Whitespace-only changes.

_posts/plotly_js/financial/gauge/2019-07-30-multi-gauge.html

Whitespace-only changes.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: JavaScript Graphing Library D3.js-based Gauge Charts| Examples | Plotly
3+
name: Gauge Charts
4+
permalink: javascript/gauge-charts/
5+
description: How to make a D3.js-based gauge chart in javascript.
6+
layout: user-guide
7+
thumbnail: thumbnail/gauge.jpg
8+
language: plotly_js
9+
has_thumbnail: true
10+
display_as: financial
11+
order: 4
12+
redirect_from: javascript-graphing-library//gauge-charts
13+
---
14+
{% assign examples = site.posts | where:"language","plotly_js" | where:"suite","gauge-charts" | sort: "order" %}
15+
{% include auto_examples.html examples=examples %}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Add Steps, Threshold, and Delta
3+
plot_url: https://codepen.io/plotly/embed/zgwrMW/?height=600&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: gauge-charts
6+
order: 2
7+
sitemap: false
8+
arrangement: horizontal
9+
markdown_content: |
10+
11+
The following examples include "steps" attribute shown as shading inside the radial arc, "delta" which is the
12+
difference of the value and goal (reference - value), and "threshold" to determine boundaries that visually alert you if the value cross a defined threshold.
13+
---
14+
var data = [{domain: {x: [0, 1], y: [0, 1]}, value: 450, title: {text: "Speed"},
15+
type: "indicator", mode: "gauge+number+delta", delta: {reference: 380}, gauge:
16+
{axis: {range: [null, 500]}, steps: [{range: [0, 250], color: "lightgray"},
17+
{range: [250, 400], color: "gray"}], threshold: {line: {color: "red", width: 4},
18+
thickness: 0.75, value: 490}}}];
19+
20+
var layout = {width: 600, height: 500, margin: {t: 0, b: 0}};
21+
Plotly.newPlot(gd,data,layout);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
name: Basic Gauge
3+
plot_url: https://codepen.io/plotly/embed/aeWOEx/?height=600&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: gauge-charts
6+
order: 1
7+
sitemap: false
8+
arrangement: horizontal
9+
markdown_content: |
10+
11+
A radial gauge chart has a circular arc, which displays a single value to estimate progress toward a goal.
12+
The bar shows the target value, and the shading represents the progress toward that goal. Gauge charts, known as
13+
speedometer charts as well. This chart type is usually used to illustrate key business indicators.
14+
15+
The example below displays a basic gauge chart with default attributes. For more information about different added attributes check [indicator](https://plot.ly/javascript/indicator/) tutorial.
16+
---
17+
var data = [{domain: {x: [0, 1], y: [0, 1]}, value: 270, title: {text: "Speed"},
18+
type: "indicator", mode: "gauge+number"}];
19+
20+
var layout = {width: 500, height: 500, margin: {t: 0, b: 0}};
21+
Plotly.newPlot(gd,data,layout);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Custom Gauge Chart
3+
plot_url: https://codepen.io/plotly/embed/zgZYmZ/?height=600&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: gauge-charts
6+
order: 3
7+
sitemap: false
8+
arrangement: horizontal
9+
markdown_content: |
10+
11+
The following example shows how to style your gauge charts. For more information about all possible options check our [reference page](https://plot.ly/javascript/reference/#indicator).
12+
---
13+
var data = [{domain: {x: [0, 1], y: [0, 1]}, value: 420, title: {text: "Speed",
14+
font: {size: 24}}, type: "indicator", mode: "gauge+number+delta",
15+
delta: {reference: 400, increasing: {color: "RebeccaPurple"}},
16+
gauge: {axis: {range: [null, 500], tickwidth: 1, tickcolor: "darkblue"},
17+
bar: {color: "darkblue"}, bgcolor: "white", borderwidth: 2, bordercolor: "gray",
18+
steps: [{range: [0, 250], color: 'cyan'}, {range: [250, 400], color: 'royalblue'
19+
}], threshold: {line: {color: "red", width: 4}, thickness: 0.75, value: 490}}}];
20+
21+
var layout = {width: 500, height: 400, margin: {t: 25, r: 25, l: 25, b: 25},
22+
paper_bgcolor: "lavender", font: {color: "darkblue", family: "Arial"}};
23+
24+
Plotly.newPlot(gd,data,layout);
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
name: Multi Gauge
3+
plot_url: https://codepen.io/plotly/embed/bXBVZp/?height=600&theme-id=15263&default-tab=result
4+
language: plotly_js
5+
suite: gauge-charts
6+
order: 4
7+
sitemap: false
8+
arrangement: horizontal
9+
markdown_content: |
10+
11+
Gauge charts are useful for comparing values between a small number of variables by using multiple gauges.
12+
13+
---
14+
var data = [
15+
{
16+
domain: {x: [0, 0.5], y: [0.5, 1]}, value: 350, title: {text: "Speed"},
17+
type: "indicator", mode: "gauge+number", delta: {reference: 400}, gauge: {axis:
18+
{range: [null, 500]}, bar:{color:"darkblue"}, steps: [{range: [0, 250],
19+
color: "cyan"}, {range: [250, 400], color: "royalblue"}], threshold: {line:
20+
{color: "red", width: 4}, thickness: 0.8, value: 490}}},
21+
{
22+
domain: {x: [0.6, 1], y: [0.5, 0.8]}, value: 300, type: "indicator",
23+
title: {text: "Speed<br><span style='font-size:0.8em;color:gray'>Time</span>"},
24+
delta: {reference: 400}, gauge: {axis: {range: [null, 500]},
25+
bar:{color:"darkblue"}, bgcolor: "white", steps: [{range: [0, 250],
26+
color: "cyan"}, {range: [250, 400], color: "royalblue"}], mode: "gauge+delta",
27+
threshold: {line: {color: "red", width: 4}, thickness: 0.75, value: 490}}},
28+
{
29+
domain: {x: [0, 1], y: [0, 0.4]}, value: 240, title: {"text": "Speed"},
30+
type: "indicator", mode: "gauge+number+delta", delta: {"reference": 400},
31+
gauge: {bar: {color: "darkblue"}, axis: {range: [null, 500]}, steps: [{range: [0, 250],
32+
color: "cyan"}, {range: [250, 400], color: "royalblue"}],
33+
threshold: {line: {color: "red", width: 4}, thickness: 0.75, value: 490}}}];
34+
35+
var layout = {width: 500, height: 500, margin: {t: 25, r: 25, l: 25, b: 25},
36+
shapes: [{type: "rect", x0: -0.03, x1: 0.56, y0: 0.55, y1: 1,
37+
line: {color: "gray", width: 1}}]};
38+
39+
Plotly.newPlot(gd,data,layout);

0 commit comments

Comments
 (0)