User Tools

Site Tools


en:pie

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:pie [2016/09/08 12:20]
admin
en:pie [2020/02/28 10:46]
Line 1: Line 1:
-===== Pie (Statement) ===== 
- 
-==== Format ==== 
- 
-**pie** [[numericexpressions|x_position]], [[numericexpressions|y_position]], [[numericexpressions|width]], [[numericexpressions|height]], [[numericexpressions|start_angle]], [[numericexpressions|width_angle]]\\ 
-**pie** ( [[numericexpressions|x_position]], [[numericexpressions|y_position]], [[numericexpressions|width]], [[numericexpressions|height]], [[numericexpressions|start_angle]], [[numericexpressions|width_angle]] )\\ 
-**pie** [[numericexpressions|center_x_position]], [[numericexpressions|center_y_position]], [[numericexpressions|radius]], [[numericexpressions|start_angle]], [[numericexpressions|width_angle]]\\ 
-**pie** ( [[numericexpressions|center_x_position]], [[numericexpressions|center_y_position]], [[numericexpressions|radius]], [[numericexpressions|start_angle]], [[numericexpressions|width_angle]] ) 
- 
- 
-==== Description ==== 
- 
-Draws a pie shaped slice inside the rectangle defined by a bounding rectangle (defined by [[numericexpressions|x_position]], [[numericexpressions|y_position]], [[numericexpressions|width]], and [[numericexpressions|height]]) or by a square bounding a circle (defined by [[numericexpressions|center_x_position]], [[numericexpressions|center_y_position]], [[numericexpressions|radius]]).  The angles are defined from the 12 o'clock position in a clockwise direction in radians.  
- 
-==== Example ==== 
- 
-<code> 
-# pie_chart.kbs 
-# 2012-12-29 j.m.reneau 
-# 
-# example of pie statement added on 0.9.9.25 
- 
-dim data(5) 
-data = {1,3,5,7,10} 
-dim colors(5) 
-colors = {red,blue,green,yellow,cyan} 
-total = 0 
-for n = 0 to data[?]-1 
-   total += data[n] 
-next n 
- 
-clg 
-font "Arial", 20,100 
-startangle = 0 
-for n = 0 to data[?]-1 
-   # calculate the with of the pie slice in radians 
-   slicesize = 2*pi*data[n]/total 
-   color colors[n] 
-   pie 50,50,200,200,startangle,slicesize 
-   # draw the value's number  outside the pie 
-   text 140+sin(startangle+slicesize*.5)*120, 140-cos(startangle+slicesize*.5)*120, data[n] 
-   startangle += slicesize 
-next n</code> 
-draws\\ 
-{{:pie_chart.png|Pie_Chart}} 
- 
-==== See Also ==== 
-{{page>en:start#Graphics - Drawing&noheader}} 
- 
-==== History ====  
-|0.9.9.25|New To Version| 
-|1.99.99.65|Added bounding square defined by circle| 
  
en/pie.txt ยท Last modified: 2020/02/28 10:46 (external edit)