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

Skip to content

Commit 96b3345

Browse files
author
Joseph Damiba
authored
Merge pull request #1671 from plotly/inside-text-fixup
Inside text fixup
2 parents 63e6a59 + 025a0f2 commit 96b3345

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

_posts/plotly_js/basic/pie/2020-01-14-inside-text-orientation.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
name: Control text orientation inside Pie slices
2+
name: Control Text Orientation Inside Pie Chart Sectors
33
language: plotly_js
44
suite: pie
55
order: 5
66
sitemap: false
77
arrangement: horizontal
88
markdown_content: |
9-
The [insidetextorientation](https://plot.ly/javascript/reference/#pie-insidetextorientation) attribute controls the orientation of the texts inside slices. With 'auto' the texts may automatically be rotated to fit with the maximum size inside the slice. The other three options 'horizontal', 'radial', and 'tangential' forces text to be horizontal, radial, and tangential.
9+
The `insidetextorientation` attribute controls the orientation of the text inside chart sectors. When set to *auto*, text may be oriented in any direction in order to be as big as possible in the middle of a sector. The *horizontal* option orients text to be parallel with the bottom of the chart, and may make text smaller in order to achieve that goal. The *radial* option orients text along the radius of the sector. The *tangential* option orients text perpendicular to the radius of the sector.
1010
---
1111
var data = [{
1212
type: "pie",
@@ -15,6 +15,7 @@
1515
textinfo: "label+percent",
1616
insidetextorientation: "radial"
1717
}]
18+
1819
var layout = [{
1920
height: 700,
2021
width: 700
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
---
2-
name: Control text orientation inside Sunburst slices
2+
name: Control Text Orientation Inside Sunburst Chart Sectors
33
language: plotly_js
44
suite: sunburst
55
order: 6
66
sitemap: false
77
arrangement: horizontal
88
markdown_content: |
9-
The [insidetextorientation](https://plot.ly/javascript/reference/#sunburst-insidetextorientation) attribute controls the orientation of the texts inside chart sectors. When set to 'auto' the texts may automatically be rotated to fit with the maximum size inside a sector. The other three options 'horizontal', 'radial', and 'tangential' first try to orient text at the 3:00, 6:00, 9:00, and 12:00 hours. If there is no enough room, then the text would be positioned in the middle of the arc.
9+
The `insidetextorientation` attribute controls the orientation of the text inside chart sectors. When set to *auto*, text may be oriented in any direction in order to be as big as possible in the middle of a sector. The *horizontal* option orients text to be parallel with the bottom of the chart, and may make text smaller in order to achieve that goal. The *radial* option orients text along the radius of the sector. The *tangential* option orients text perpendicular to the radius of the sector.
1010
---
1111
Plotly.d3.csv('https://raw.githubusercontent.com/plotly/datasets/master/coffee-flavors.csv', function(err, rows){
1212
function unpack(rows, key) {
1313
return rows.map(function(row) {return row[key]})
1414
}
1515

16-
var data = [{
17-
type: "sunburst",
18-
maxdepth: 2,
19-
ids: unpack(rows, 'ids'),
20-
labels: unpack(rows, 'labels'),
21-
parents: unpack(rows, 'parents'),
22-
textposition: 'inside',
23-
insidetextorientation: 'radial'
24-
}]
16+
var data = [{
17+
type: "sunburst",
18+
maxdepth: 2,
19+
ids: unpack(rows, 'ids'),
20+
labels: unpack(rows, 'labels'),
21+
parents: unpack(rows, 'parents'),
22+
textposition: 'inside',
23+
insidetextorientation: 'radial'
24+
}]
2525

26-
var layout = {margin: {l: 0, r: 0, b: 0, t:0}}
26+
var layout = {margin: {l: 0, r: 0, b: 0, t:0}}
2727

28-
Plotly.newPlot('myDiv', data, layout)
28+
Plotly.newPlot('myDiv', data, layout)
2929
})

0 commit comments

Comments
 (0)