pie-chart

ggplot2 pie plot with geom_text_repel

余生长醉 提交于 2020-01-01 10:48:12
问题 I am plotting multiple pie plots with ggplot2 and succeeded in having the labels plotted in the right positions, as: df <- data.frame(annotation=rep(c("promoter", "intergenic", "intragene", "5prime", "3prime"), 3), value=c(69.5, 16, 10.7, 2.5, 1.3, 57.2, 18.8, 20.2, 2.1, 1.7, 50.2, 32.2, 15.3, 1.2, 1.1), treatment=rep(c("treated1", "treated2", "untreated"), c(5, 5, 5))) library(ggplot2) ggplot(data = df, aes(x = "", y = value, fill = annotation)) + geom_bar(stat = "identity") + geom_text(aes

Highcharts Pie Chart.How to set labels in two lines

偶尔善良 提交于 2020-01-01 08:29:19
问题 I'm creating a pie chart in highcharts. Does anybody know how to set data labels in two lines? I'm finding this problem when the data labels are too long. http://jsfiddle.net/larrytron/fSjnD/ $(function () { $('#container').highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: 'Browser market shares at a specific website, 2010' }, tooltip: { pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>' }, plotOptions: { pie: {

How to change the X and Y axis names of Pie chart High Chart?

梦想与她 提交于 2019-12-31 05:15:11
问题 HI all i am some data in a pie chart...on hover of slice i get the hover like this [Hr Resources:x=Hr Resources,y=12] i want my tooltip to show like this [ProjectName=Hr,Logged Bugs=12] how do i do this..here is how i am binding my data to the pie chart <script type="text/javascript"> $(function () { $.getJSON('<%= Url.Action("GetData","JqueryCharts") %>', {}, function (data) { var json = data; alert(json); var jsondata = []; for (var i in json) { // var serie = new Array(json[i].Projects,

Calculate angle for rotation in Pie Chart

拥有回忆 提交于 2019-12-31 02:57:06
问题 I want to rotate the image around its center point.The problem i am facing is i need to get the angle to calculate in touch moved event (i dont want to use multi touch).I am current using the below code - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ NSArray *allTouches = [touches allObjects]; gestureStartPoint = gestureMovedPoint;//i am getting the gestureStartPoint on touch began event gestureMovedPoint = [[allTouches objectAtIndex:0] locationInView:[self superview]];

Dynamic Pie Chart Data in Javascript and PHP

人盡茶涼 提交于 2019-12-31 01:47:08
问题 The following code represent the data that will be shown in a pie chart visualization in javascript. <script type="text/javascript"> var agg = { label: 'Aggressive', pct: [60, 10, 6, 30, 14, 10] }, bal = { label: 'Balanced', pct: [24, 7, 2, 18, 13, 36] }, mod = { label: 'Moderate', pct: [12, 4, 2, 10, 11, 61] }, inc = { label: 'Income', pct: [ 0, 0, 0, 0, 0,100] }, </script> I would like to have the pct values as php variables, and not fixed as in the code above. How do I do this? I would

How can I show a subset of data on pie pieces in Chart.JS while still displaying the superset when hovering?

▼魔方 西西 提交于 2019-12-30 13:37:12
问题 I've got a pie chart that looks like this when hovering over a piece of pie: Except for wanting the legend to the right instead of on top, I'm fairly content with this, but I want just the percentage value to display "all the time" in the pie pieces - and still have the <name> (<%val>): <data> displayed on hover. In other words, I want the pie to look something like this: How can I break that one piece of data out (the percentage) and draw that onto each piece of pie? Here is the code I'm

Add legend to pie chart in dc.js

房东的猫 提交于 2019-12-30 09:35:17
问题 I'm building a dc.js-based visualization where one of the charts is a pie chart. See: http://jsfiddle.net/luiseth/t8we6/ The peculiarity of my case is that the labels that this chart will display are usually rather long, so much that usually get clipped by the chart's container (the <div> ). So I thought of having them appear on a legend, but I haven't been able to figure how to have the legend appear to the right of the chart. How can I do that? Playing around with the width has not helped

Changing the radius of a coord_polar ggplot

六眼飞鱼酱① 提交于 2019-12-29 07:47:10
问题 I'm looking to reduce the display radius of a pie chart built in ggplot2 relative to the rest of the plot (as the defaults keep cutting off my category labels). Here's some dummy data and code that should show you what I'm experiencing: library(ggplot2) library(scales) library(grid) Region <- c("North America", "Central America", "South America", "Carribbean", "Western Africa", "Northern Africa", "Southern Afica", "Eastern Africa") Conti <- c(rep("Americas",4), rep("Africa",4)) Freq <- c

ggplot pie chart labeling

风流意气都作罢 提交于 2019-12-29 07:08:45
问题 I am struggling with getting the pie chart labels correct. Looked around and thought that I could easily implement what mathematicalCoffee did. So far I have this code: ltr = LETTERS[seq( from = 1, to = 26)] wght = runif(length(ltr)) wght = wght/sum(wght) wght = round(wght, digits = 2) alloc = as.data.frame(cbind(ltr, wght)) alloc$wght = as.numeric(as.character(alloc$wght)) ggpie <- function (dat, by, totals) { ggplot(dat, aes_string(x=factor(1), y=totals, fill=by)) + geom_bar(stat='identity'

How to display pie slice data and tooltip together using chart.js

荒凉一梦 提交于 2019-12-26 05:38:50
问题 Can we display data in pie chart slice and also tolltip like the above image using chart.js? Updated: Here is my code in php page. printf( '<table>' ); echo '<tr><td style="text-align: right;"><canvas id="pie-canvas-' . $canvasId . '" width=256px height=257px ></canvas></td><td style="text-align: left;width:360px;" id="legend" class="chart-legend"></td></tr>'; echo '<script type="text/javascript">drawPie(' . $canvasId . ', ' . $data .', ' . $legend . ');</script>'; printf( '</table>' );