#!ngraph
#%creator: Ngraph 
#%version: 6.08.05
new parameter
	parameter::title='_Start angle:'
	parameter::type=SpinButton
	parameter::min=0
	parameter::max=359
	parameter::step=1
	parameter::start=0
	parameter::stop=100
	parameter::wait=10
	parameter::wrap=true
	parameter::items=
	parameter::redraw=true
	parameter::active=false
	parameter::selected=0
	parameter::value=150
	parameter::transition=stop

new parameter
	parameter::title='_Color:'
	parameter::type=Switch
	parameter::min=0
	parameter::max=100
	parameter::step=1
	parameter::start=0
	parameter::stop=100
	parameter::wait=10
	parameter::wrap=false
	parameter::items=
	parameter::redraw=true
	parameter::active=true
	parameter::selected=0
	parameter::value=0
	parameter::transition=stop

new axis name:fX1
	axis::hidden=false
	axis::R=0
	axis::G=0
	axis::B=0
	axis::A=255
	axis::clip=true
	axis::redraw_flag=true
	axis::min=0
	axis::max=1
	axis::inc=1
	axis::div=0
	axis::type=linear
	axis::x=5000
	axis::y=24600
	axis::direction=0
	axis::baseline=true
	axis::length=11000
	axis::width=40
	axis::style=
	axis::auto_scale_margin=0
	axis::adjust_axis=
	axis::adjust_position=0
	axis::arrow=none
	axis::arrow_length=72426
	axis::arrow_width=60000
	axis::wave=none
	axis::wave_length=300
	axis::wave_width=40
	axis::reference=
	axis::gauge=right
	axis::gauge_min=0
	axis::gauge_max=0
	axis::gauge_style=
	axis::gauge_length1=100
	axis::gauge_width1=40
	axis::gauge_length2=200
	axis::gauge_width2=40
	axis::gauge_length3=300
	axis::gauge_width3=40
	axis::gauge_R=0
	axis::gauge_G=0
	axis::gauge_B=0
	axis::gauge_A=255
	axis::num=right
	axis::num_begin=0
	axis::num_step=0
	axis::num_num=-1
	axis::num_auto_norm=5
	axis::num_head=
	axis::num_format='%g'
	axis::num_tail=
	axis::num_log_pow=true
	axis::num_pt=2000
	axis::num_space=0
	axis::num_font='Sans-serif'
	axis::num_font_style=0
	axis::num_script_size=7000
	axis::num_align=center
	axis::num_no_zero=regular
	axis::num_direction=horizontal
	axis::num_shift_p=0
	axis::num_shift_n=100
	axis::num_R=0
	axis::num_G=0
	axis::num_B=0
	axis::num_A=255
	axis::num_date_format=
	axis::num_math=

new axis name:fY1
	axis::hidden=false
	axis::R=0
	axis::G=0
	axis::B=0
	axis::A=255
	axis::clip=true
	axis::redraw_flag=true
	axis::min=0.7
	axis::max=4.3
	axis::inc=1
	axis::div=0
	axis::type=linear
	axis::x=5000
	axis::y=24600
	axis::direction=9000
	axis::baseline=false
	axis::length=11000
	axis::width=40
	axis::style=
	axis::auto_scale_margin=1000
	axis::adjust_axis=
	axis::adjust_position=0
	axis::arrow=none
	axis::arrow_length=72426
	axis::arrow_width=60000
	axis::wave=none
	axis::wave_length=300
	axis::wave_width=40
	axis::reference=
	axis::gauge=none
	axis::gauge_min=0
	axis::gauge_max=0
	axis::gauge_style=
	axis::gauge_length1=100
	axis::gauge_width1=40
	axis::gauge_length2=200
	axis::gauge_width2=40
	axis::gauge_length3=300
	axis::gauge_width3=40
	axis::gauge_R=0
	axis::gauge_G=0
	axis::gauge_B=0
	axis::gauge_A=255
	axis::num=left
	axis::num_begin=0
	axis::num_step=0
	axis::num_num=-1
	axis::num_auto_norm=5
	axis::num_head=
	axis::num_format='%g'
	axis::num_tail=
	axis::num_log_pow=true
	axis::num_pt=2000
	axis::num_space=0
	axis::num_font='Sans-serif'
	axis::num_font_style=0
	axis::num_script_size=7000
	axis::num_align=right
	axis::num_no_zero=regular
	axis::num_direction=horizontal
	axis::num_shift_p=0
	axis::num_shift_n=100
	axis::num_R=0
	axis::num_G=0
	axis::num_B=0
	axis::num_A=255
	axis::num_date_format=
	axis::num_math=

new axis name:fU1
	axis::hidden=true
	axis::R=0
	axis::G=0
	axis::B=0
	axis::A=255
	axis::clip=true
	axis::redraw_flag=true
	axis::min=0
	axis::max=0
	axis::inc=0
	axis::div=0
	axis::type=linear
	axis::x=5000
	axis::y=13600
	axis::direction=0
	axis::baseline=true
	axis::length=11000
	axis::width=40
	axis::style=
	axis::auto_scale_margin=500
	axis::adjust_axis=
	axis::adjust_position=0
	axis::arrow=none
	axis::arrow_length=72426
	axis::arrow_width=60000
	axis::wave=none
	axis::wave_length=300
	axis::wave_width=40
	axis::reference='axis:0'
	axis::gauge=right
	axis::gauge_min=0
	axis::gauge_max=0
	axis::gauge_style=
	axis::gauge_length1=100
	axis::gauge_width1=40
	axis::gauge_length2=200
	axis::gauge_width2=40
	axis::gauge_length3=300
	axis::gauge_width3=40
	axis::gauge_R=0
	axis::gauge_G=0
	axis::gauge_B=0
	axis::gauge_A=255
	axis::num=left
	axis::num_begin=0
	axis::num_step=0
	axis::num_num=-1
	axis::num_auto_norm=5
	axis::num_head=
	axis::num_format='%g'
	axis::num_tail=
	axis::num_log_pow=true
	axis::num_pt=2000
	axis::num_space=0
	axis::num_font='Sans-serif'
	axis::num_font_style=0
	axis::num_script_size=7000
	axis::num_align=center
	axis::num_no_zero=regular
	axis::num_direction=horizontal
	axis::num_shift_p=0
	axis::num_shift_n=100
	axis::num_R=0
	axis::num_G=0
	axis::num_B=0
	axis::num_A=255
	axis::num_date_format=
	axis::num_math=

new axis name:fR1
	axis::hidden=true
	axis::R=0
	axis::G=0
	axis::B=0
	axis::A=255
	axis::clip=true
	axis::redraw_flag=true
	axis::min=0
	axis::max=0
	axis::inc=0
	axis::div=0
	axis::type=linear
	axis::x=16000
	axis::y=24600
	axis::direction=9000
	axis::baseline=true
	axis::length=11000
	axis::width=40
	axis::style=
	axis::auto_scale_margin=500
	axis::adjust_axis=
	axis::adjust_position=0
	axis::arrow=none
	axis::arrow_length=72426
	axis::arrow_width=60000
	axis::wave=none
	axis::wave_length=300
	axis::wave_width=40
	axis::reference='axis:1'
	axis::gauge=left
	axis::gauge_min=0
	axis::gauge_max=0
	axis::gauge_style=
	axis::gauge_length1=100
	axis::gauge_width1=40
	axis::gauge_length2=200
	axis::gauge_width2=40
	axis::gauge_length3=300
	axis::gauge_width3=40
	axis::gauge_R=0
	axis::gauge_G=0
	axis::gauge_B=0
	axis::gauge_A=255
	axis::num=right
	axis::num_begin=0
	axis::num_step=0
	axis::num_num=-1
	axis::num_auto_norm=5
	axis::num_head=
	axis::num_format='%g'
	axis::num_tail=
	axis::num_log_pow=true
	axis::num_pt=2000
	axis::num_space=0
	axis::num_font='Sans-serif'
	axis::num_font_style=0
	axis::num_script_size=7000
	axis::num_align=left
	axis::num_no_zero=regular
	axis::num_direction=horizontal
	axis::num_shift_p=0
	axis::num_shift_n=100
	axis::num_R=0
	axis::num_G=0
	axis::num_B=0
	axis::num_A=255
	axis::num_date_format=
	axis::num_math=

axis::grouping 1 0 1 2 3

new axis name:fX2
	axis::hidden=false
	axis::R=0
	axis::G=0
	axis::B=0
	axis::A=255
	axis::clip=true
	axis::redraw_flag=true
	axis::min=0.5
	axis::max=4.5
	axis::inc=1
	axis::div=0
	axis::type=linear
	axis::x=1000
	axis::y=12400
	axis::direction=0
	axis::baseline=false
	axis::length=19000
	axis::width=40
	axis::style=
	axis::auto_scale_margin=0
	axis::adjust_axis=
	axis::adjust_position=0
	axis::arrow=none
	axis::arrow_length=72426
	axis::arrow_width=60000
	axis::wave=none
	axis::wave_length=300
	axis::wave_width=40
	axis::reference=
	axis::gauge=none
	axis::gauge_min=0
	axis::gauge_max=0
	axis::gauge_style=
	axis::gauge_length1=100
	axis::gauge_width1=40
	axis::gauge_length2=200
	axis::gauge_width2=40
	axis::gauge_length3=300
	axis::gauge_width3=40
	axis::gauge_R=0
	axis::gauge_G=0
	axis::gauge_B=0
	axis::gauge_A=255
	axis::num=right
	axis::num_begin=0
	axis::num_step=0
	axis::num_num=-1
	axis::num_auto_norm=5
	axis::num_head=
	axis::num_format='%g'
	axis::num_tail=
	axis::num_log_pow=true
	axis::num_pt=2000
	axis::num_space=0
	axis::num_font='Sans-serif'
	axis::num_font_style=0
	axis::num_script_size=7000
	axis::num_align=center
	axis::num_no_zero=regular
	axis::num_direction=horizontal
	axis::num_shift_p=0
	axis::num_shift_n=100
	axis::num_R=0
	axis::num_G=0
	axis::num_B=0
	axis::num_A=255
	axis::num_date_format=
	axis::num_math=

new axis name:fY2
	axis::hidden=true
	axis::R=0
	axis::G=0
	axis::B=0
	axis::A=255
	axis::clip=true
	axis::redraw_flag=true
	axis::min=-0.5
	axis::max=0.5
	axis::inc=1
	axis::div=0
	axis::type=linear
	axis::x=1000
	axis::y=12400
	axis::direction=9000
	axis::baseline=true
	axis::length=4500
	axis::width=40
	axis::style=
	axis::auto_scale_margin=1000
	axis::adjust_axis=
	axis::adjust_position=0
	axis::arrow=none
	axis::arrow_length=72426
	axis::arrow_width=60000
	axis::wave=none
	axis::wave_length=300
	axis::wave_width=40
	axis::reference=
	axis::gauge=right
	axis::gauge_min=0
	axis::gauge_max=0
	axis::gauge_style=
	axis::gauge_length1=100
	axis::gauge_width1=40
	axis::gauge_length2=200
	axis::gauge_width2=40
	axis::gauge_length3=300
	axis::gauge_width3=40
	axis::gauge_R=0
	axis::gauge_G=0
	axis::gauge_B=0
	axis::gauge_A=255
	axis::num=left
	axis::num_begin=0
	axis::num_step=0
	axis::num_num=-1
	axis::num_auto_norm=5
	axis::num_head=
	axis::num_format='%g'
	axis::num_tail=
	axis::num_log_pow=true
	axis::num_pt=2000
	axis::num_space=0
	axis::num_font='Sans-serif'
	axis::num_font_style=0
	axis::num_script_size=7000
	axis::num_align=right
	axis::num_no_zero=regular
	axis::num_direction=horizontal
	axis::num_shift_p=0
	axis::num_shift_n=100
	axis::num_R=0
	axis::num_G=0
	axis::num_B=0
	axis::num_A=255
	axis::num_date_format=
	axis::num_math=

new axis name:fU2
	axis::hidden=true
	axis::R=0
	axis::G=0
	axis::B=0
	axis::A=255
	axis::clip=true
	axis::redraw_flag=true
	axis::min=0
	axis::max=0
	axis::inc=0
	axis::div=0
	axis::type=linear
	axis::x=1000
	axis::y=7900
	axis::direction=0
	axis::baseline=true
	axis::length=19000
	axis::width=40
	axis::style=
	axis::auto_scale_margin=500
	axis::adjust_axis=
	axis::adjust_position=0
	axis::arrow=none
	axis::arrow_length=72426
	axis::arrow_width=60000
	axis::wave=none
	axis::wave_length=300
	axis::wave_width=40
	axis::reference='axis:4'
	axis::gauge=right
	axis::gauge_min=0
	axis::gauge_max=0
	axis::gauge_style=
	axis::gauge_length1=100
	axis::gauge_width1=40
	axis::gauge_length2=200
	axis::gauge_width2=40
	axis::gauge_length3=300
	axis::gauge_width3=40
	axis::gauge_R=0
	axis::gauge_G=0
	axis::gauge_B=0
	axis::gauge_A=255
	axis::num=left
	axis::num_begin=0
	axis::num_step=0
	axis::num_num=-1
	axis::num_auto_norm=5
	axis::num_head=
	axis::num_format='%g'
	axis::num_tail=
	axis::num_log_pow=true
	axis::num_pt=2000
	axis::num_space=0
	axis::num_font='Sans-serif'
	axis::num_font_style=0
	axis::num_script_size=7000
	axis::num_align=center
	axis::num_no_zero=regular
	axis::num_direction=horizontal
	axis::num_shift_p=0
	axis::num_shift_n=100
	axis::num_R=0
	axis::num_G=0
	axis::num_B=0
	axis::num_A=255
	axis::num_date_format=
	axis::num_math=

new axis name:fR2
	axis::hidden=true
	axis::R=0
	axis::G=0
	axis::B=0
	axis::A=255
	axis::clip=true
	axis::redraw_flag=true
	axis::min=0
	axis::max=0
	axis::inc=0
	axis::div=0
	axis::type=linear
	axis::x=20000
	axis::y=12400
	axis::direction=9000
	axis::baseline=true
	axis::length=4500
	axis::width=40
	axis::style=
	axis::auto_scale_margin=500
	axis::adjust_axis=
	axis::adjust_position=0
	axis::arrow=none
	axis::arrow_length=72426
	axis::arrow_width=60000
	axis::wave=none
	axis::wave_length=300
	axis::wave_width=40
	axis::reference='axis:5'
	axis::gauge=left
	axis::gauge_min=0
	axis::gauge_max=0
	axis::gauge_style=
	axis::gauge_length1=100
	axis::gauge_width1=40
	axis::gauge_length2=200
	axis::gauge_width2=40
	axis::gauge_length3=300
	axis::gauge_width3=40
	axis::gauge_R=0
	axis::gauge_G=0
	axis::gauge_B=0
	axis::gauge_A=255
	axis::num=right
	axis::num_begin=0
	axis::num_step=0
	axis::num_num=-1
	axis::num_auto_norm=5
	axis::num_head=
	axis::num_format='%g'
	axis::num_tail=
	axis::num_log_pow=true
	axis::num_pt=2000
	axis::num_space=0
	axis::num_font='Sans-serif'
	axis::num_font_style=0
	axis::num_script_size=7000
	axis::num_align=left
	axis::num_no_zero=regular
	axis::num_direction=horizontal
	axis::num_shift_p=0
	axis::num_shift_n=100
	axis::num_R=0
	axis::num_G=0
	axis::num_B=0
	axis::num_A=255
	axis::num_date_format=
	axis::num_math=

axis::grouping 1 4 5 6 7

new data
	data::hidden=false
	data::R=0
	data::G=0
	data::B=0
	data::A=255
	data::clip=true
	data::redraw_flag=true
	data::source=file
	data::save_path=unchange
	data::x=1
	data::y=0
	data::type=mark
	data::interpolation=spline
	data::fit=
	data::math_x='const HEIGHT = 0.5;         # height of a bar graph
const FILL = parameter(1);  # fill or not
shift(col);                 # remove %0 from the array col
n = size(col);              # number of the data
total = array_sum(col);     # summation of the data
start = 0;                  # start position of a rectangle
text_size(10);              # set font size
each_with_index(col, w, i,  # draw rectangle for each data
  {
    width = w / total;      # width of a rectangle
    hsb2(i / n, 0.7, 1);    # set fill color
    draw_rect(start, y - HEIGHT / 2, width, HEIGHT, TRUE, FILL);
    sprintf($str, "%.1f%%", width * 100);
    text_align(0, 0.5);
    draw_text_raw($str, start + 0.01, y, a);
    start += width;
  });'
	data::math_y=
	data::func_f=
	data::func_g=
	data::func_h=
	data::smooth_x=0
	data::smooth_y=0
	data::averaging_type=simple
	data::mark_type=0
	data::mark_size=0
	data::line_width=40
	data::line_style=
	data::line_join=bevel
	data::line_miter_limit=1000
	data::R2=255
	data::G2=255
	data::B2=255
	data::A2=255
	data::remark='#%'\'''
	data::ifs=' ,	()'
	data::csv=false
	data::head_skip=0
	data::read_step=1
	data::final_line=-1
	data::mask=
	data::move_data=
	data::move_data_x=
	data::move_data_y=
	data::axis_x='axis:0'
	data::axis_y='axis:1'
	data::data_clip=true
	data::range_min=1
	data::range_max=10
	data::range_div=512
	data::array=
	data::file='demo9.dat'

new data
	data::hidden=false
	data::R=0
	data::G=0
	data::B=0
	data::A=255
	data::clip=true
	data::redraw_flag=true
	data::source=file
	data::save_path=unchange
	data::x=1
	data::y=0
	data::type=mark
	data::interpolation=spline
	data::fit=
	data::math_x='const R = 0.4;           # radius of a pie chart
const FILL = parameter(1);  # fill or not
shift(col);              # remove %0 from the array col
n = size(col);           # number of the data
total = array_sum(col);  # summation of the data
angle2 = parameter(0);
array_clear(ang);
map(ang, col, a, a / total * 360);
text_size(10);
each_with_index(ang, a, i,# draw pie-slice for each data
  {
    hsb2(i / n, 0.7, 1);  # set fill color
    angle2 += a;
    draw_arc(y, 0, R, R, angle2, -a, TRUE, TRUE, FILL, TRUE);
    sprintf($str, "%.1f%%", a / 3.60);
    text_align(0.5, 0.6);
    a = (angle2 - a * 0.5) * PI / 180;
    draw_text_raw($str, y + R * 0.65 * cos(a), R * 0.65 * sin(a));
  });'
	data::math_y=
	data::func_f=
	data::func_g=
	data::func_h=
	data::smooth_x=0
	data::smooth_y=0
	data::averaging_type=simple
	data::mark_type=0
	data::mark_size=0
	data::line_width=40
	data::line_style=
	data::line_join=bevel
	data::line_miter_limit=1000
	data::R2=255
	data::G2=255
	data::B2=255
	data::A2=255
	data::remark='#%'\'''
	data::ifs=' ,	()'
	data::csv=false
	data::head_skip=0
	data::read_step=1
	data::final_line=-1
	data::mask=
	data::move_data=
	data::move_data_x=
	data::move_data_y=
	data::axis_x='axis:4'
	data::axis_y='axis:5'
	data::data_clip=true
	data::range_min=1
	data::range_max=10
	data::range_div=512
	data::array=
	data::file='demo9.dat'

new text
	text::hidden=false
	text::R=0
	text::G=0
	text::B=0
	text::A=255
	text::clip=true
	text::redraw_flag=true
	text::text='Demo #9:\ndraw\_rect(), draw\_arc() and parameter() FUNCTIONS'
	text::x=2000
	text::y=6842
	text::pt=2000
	text::font='Sans-serif'
	text::style=1
	text::space=0
	text::direction=0
	text::script_size=7000
	text::raw=false

new gra name:viewer
	gra::left_margin=0
	gra::top_margin=0
	gra::zoom=10000
	gra::paper_width=21000
	gra::paper_height=29700
	gra::draw_obj='axisgrid axis data merge legend rectangle arc path mark text'
