Subversion Repositories wimsdev

Rev

Rev 7749 | Rev 7780 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7749 Rev 7779
Line 640... Line 640...
640
                    }
640
                    }
641
                }
641
                }
642
            }
642
            }
643
            /* draw path :  closed & optional filled */
643
            /* draw path :  closed & optional filled */
644
                decimals = find_number_of_digits(precision);
644
                decimals = find_number_of_digits(precision);
645
                string_length = snprintf(NULL,0,"dragstuff.addShape(new Shape(%d,%d,%d,5,%s,[30],[30],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\"));\n",click_cnt,onclick,drag_type,double_xy2js_array(double_data,i,decimals),line_width,stroke_color,stroke_opacity,stroke_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family);
-
 
646
                fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,5,%s,[30],[30],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\"));\n",click_cnt,onclick,drag_type,double_xy2js_array(double_data,i,decimals),line_width,stroke_color,stroke_opacity,stroke_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family);
645
                fprintf(js_include_file,"dragstuff.addShape(new Shape(%d,%d,%d,5,%s,[30],[30],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\"));\n",click_cnt,onclick,drag_type,double_xy2js_array(double_data,i,decimals),line_width,stroke_color,stroke_opacity,stroke_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family);
647
                click_cnt++;reset();
646
                click_cnt++;reset();
648
            break;
647
            break;
649
        case ARC:
648
        case ARC:
650
        /*
649
        /*
Line 2537... Line 2536...
2537
         @ the x/y-range are set using commands 'xrange xmin,xmax' and 'yrange ymin,ymax'
2536
         @ the x/y-range are set using commands 'xrange xmin,xmax' and 'yrange ymin,ymax'
2538
         @ ymajor is the major step on the y-axis; yminor is the divisor for the y-step
2537
         @ ymajor is the major step on the y-axis; yminor is the divisor for the y-step
2539
         @ the linewidth is set using command 'linewidth int'
2538
         @ the linewidth is set using command 'linewidth int'
2540
         @ the opacity of major / minor grid lines is set by command 'opacity [0-255],[0-255]'
2539
         @ the opacity of major / minor grid lines is set by command 'opacity [0-255],[0-255]'
2541
         @ default logbase number = 10 ... when needed , set the logbase number with command 'xlogbase number'
2540
         @ default logbase number = 10 ... when needed , set the logbase number with command 'xlogbase number'
2542
         @ the x/y- axis numbering is triggered by keyword 'axisnumbering'<ul><li>use commands 'xlabel some_text' and/or 'ylabel some_text' for text on axis : use command 'fontsize int' to set the fontsize (default 12px)</li><li>use command 'fontfamily fnt_family_string' to set the fonts for axis-numbering</li><li>use command'fontcolor' to set the colour</li></ul>
2541
         @ the x/y- axis numbering is triggered by keyword 'axisnumbering'<ul><li>use command 'precision' before 'xlogscale' command to set the precision (decimals) of the axis numbering</li><li>use commands 'xlabel some_text' and/or 'ylabel some_text' for text on axis : use command 'fontsize int' to set the fontsize (default 12px)</li><li>use command 'fontfamily fnt_family_string' to set the fonts for axis-numbering</li><li>use command'fontcolor' to set the colour</li></ul>
2543
         @ note: the complete canvas will be used for the 'log paper'
2542
         @ note: the complete canvas will be used for the 'log paper'
2544
         @ note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
2543
         @ note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
2545
         @ note: command 'mouse color,fontsize' will show the real values in the logpaper.<br />\
2544
         @ note: command 'mouse color,fontsize' will show the real values in the logpaper.<br />\
2546
         @ note: when using something like 'xrange 0.0001,0.01'...combined with commands 'mouse color,fontsize' and/or 'userdraw type,color'...<br /> make sure the precision is set accordingly (eg command 'precision 10000')  
2545
         @ note: when using something like 'xrange 0.0001,0.01'...combined with commands 'mouse color,fontsize' and/or 'userdraw type,color'...<br /> make sure the precision is set accordingly (eg command 'precision 10000')  
2547
         @ note: in case of userdraw , the use of keyword 'userinput_xy' may be handy !
2546
         @ note: in case of userdraw , the use of keyword 'userinput_xy' may be handy !
Line 2553... Line 2552...
2553
                switch(i){
2552
                switch(i){
2554
                    case 0: double_data[0] = get_real(infile,0);break; /* xmajor */
2553
                    case 0: double_data[0] = get_real(infile,0);break; /* xmajor */
2555
                    case 1: int_data[0] = (int) (get_real(infile,0));break; /* xminor */
2554
                    case 1: int_data[0] = (int) (get_real(infile,0));break; /* xminor */
2556
                    case 2: stroke_color = get_color(infile,0); break;
2555
                    case 2: stroke_color = get_color(infile,0); break;
2557
                    case 3: fill_color = get_color(infile,1);
2556
                    case 3: fill_color = get_color(infile,1);
2558
                        string_length = snprintf(NULL,0,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0]);
2557
                        string_length = snprintf(NULL,0,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0],precision);
2559
                        tmp_buffer = my_newmem(string_length+1);
2558
                        tmp_buffer = my_newmem(string_length+1);
2560
                        snprintf(tmp_buffer,string_length,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0]);
2559
                        snprintf(tmp_buffer,string_length,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0],precision);
2561
                        fprintf(js_include_file,"use_xlogscale=1;snap_y = %f;snap_x = xlogbase;",double_data[0]/int_data[0]);
2560
                        fprintf(js_include_file,"use_xlogscale=1;snap_y = %f;snap_x = xlogbase;",double_data[0]/int_data[0]);
2562
                        add_to_buffer(tmp_buffer);
2561
                        add_to_buffer(tmp_buffer);
2563
                        break;
2562
                        break;
2564
                    default:break;
2563
                    default:break;
2565
                }
2564
                }
Line 2571... Line 2570...
2571
         @ the x/y-range are set using commands 'xrange xmin,xmax' and 'yrange ymin,ymax'
2570
         @ the x/y-range are set using commands 'xrange xmin,xmax' and 'yrange ymin,ymax'
2572
         @ xmajor is the major step on the x-axis; xminor is the divisor for the x-step
2571
         @ xmajor is the major step on the x-axis; xminor is the divisor for the x-step
2573
         @ the linewidth is set using command 'linewidth int'
2572
         @ the linewidth is set using command 'linewidth int'
2574
         @ the opacity of major / minor grid lines is set by command 'opacity [0-255],[0-255]'
2573
         @ the opacity of major / minor grid lines is set by command 'opacity [0-255],[0-255]'
2575
         @ default logbase number = 10 ... when needed , set the logbase number with command 'ylogbase number'
2574
         @ default logbase number = 10 ... when needed , set the logbase number with command 'ylogbase number'
2576
         @ the x/y- axis numbering is triggered by keyword 'axisnumbering'<ul><li>use commands 'xlabel some_text' and/or 'ylabel some_text' for text on axis : use command 'fontsize int' to set the fontsize (default 12px)</li><li>use command 'fontfamily fnt_family_string' to set the fonts for axis-numbering</li><li>use command'fontcolor' to set the colour</li></ul>
2575
         @ the x/y- axis numbering is triggered by keyword 'axisnumbering'<ul><li>use command 'precision' before 'ylogscale' command to set the precision (decimals) of the axis numbering</li><li>use commands 'xlabel some_text' and/or 'ylabel some_text' for text on axis : use command 'fontsize int' to set the fontsize (default 12px)</li><li>use command 'fontfamily fnt_family_string' to set the fonts for axis-numbering</li><li>use command'fontcolor' to set the colour</li></ul>
2577
         @ note: the complete canvas will be used for the 'log paper'
2576
         @ note: the complete canvas will be used for the 'log paper'
2578
         @ note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
2577
         @ note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
2579
         @ note: command 'mouse color,fontsize' will show the real values in the logpaper.<br />\
2578
         @ note: command 'mouse color,fontsize' will show the real values in the logpaper.<br />\
2580
         @ note: when using something like 'yrange 0.0001,0.01'...combined with commands 'mouse color,fontsize' and/or 'userdraw type,color'...<br /> make sure the precision is set accordingly (eg command 'precision 10000')  
2579
         @ note: when using something like 'yrange 0.0001,0.01'...combined with commands 'mouse color,fontsize' and/or 'userdraw type,color'...<br /> make sure the precision is set accordingly (eg command 'precision 10000')  
2581
         @ note: in case of userdraw , the use of keyword 'userinput_xy' may be handy !
2580
         @ note: in case of userdraw , the use of keyword 'userinput_xy' may be handy !
Line 2587... Line 2586...
2587
                switch(i){
2586
                switch(i){
2588
                    case 0: double_data[0] = get_real(infile,0);break; /* xmajor */
2587
                    case 0: double_data[0] = get_real(infile,0);break; /* xmajor */
2589
                    case 1: int_data[0] = (int) (get_real(infile,0));break; /* xminor */
2588
                    case 1: int_data[0] = (int) (get_real(infile,0));break; /* xminor */
2590
                    case 2: stroke_color = get_color(infile,0); break;
2589
                    case 2: stroke_color = get_color(infile,0); break;
2591
                    case 3: fill_color = get_color(infile,1);
2590
                    case 3: fill_color = get_color(infile,1);
2592
                        string_length = snprintf(NULL,0,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0]);
2591
                        string_length = snprintf(NULL,0,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0],precision);
2593
                        tmp_buffer = my_newmem(string_length+1);
2592
                        tmp_buffer = my_newmem(string_length+1);
2594
                        snprintf(tmp_buffer,string_length,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0]);
2593
                        snprintf(tmp_buffer,string_length,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%f,%d,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,double_data[0],int_data[0],precision);
2595
                        fprintf(js_include_file,"use_ylogscale=1;snap_x = %f;snap_y = ylogbase;",double_data[0]/int_data[0]);
2594
                        fprintf(js_include_file,"use_ylogscale=1;snap_x = %f;snap_y = ylogbase;",double_data[0]/int_data[0]);
2596
                        add_to_buffer(tmp_buffer);
2595
                        add_to_buffer(tmp_buffer);
2597
                        break;
2596
                        break;
2598
                    default:break;
2597
                    default:break;
2599
                }
2598
                }
Line 2618... Line 2617...
2618
            if( js_function[DRAW_XYLOGSCALE] != 1 ){ js_function[DRAW_XYLOGSCALE] = 1;}
2617
            if( js_function[DRAW_XYLOGSCALE] != 1 ){ js_function[DRAW_XYLOGSCALE] = 1;}
2619
            for(i=0;i<2;i++){
2618
            for(i=0;i<2;i++){
2620
                switch(i){
2619
                switch(i){
2621
                    case 0: stroke_color = get_color(infile,0); break;
2620
                    case 0: stroke_color = get_color(infile,0); break;
2622
                    case 1: fill_color = get_color(infile,1);
2621
                    case 1: fill_color = get_color(infile,1);
2623
                        string_length = snprintf(NULL,0,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering);
2622
                        string_length = snprintf(NULL,0,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,precision);
2624
                        tmp_buffer = my_newmem(string_length+1);
2623
                        tmp_buffer = my_newmem(string_length+1);
2625
                        snprintf(tmp_buffer,string_length,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering);
2624
                        snprintf(tmp_buffer,string_length,"draw_grid%d(%d,%d,\"%s\",\"%s\",%.2f,%.2f,%d,\"%s\",\"%s\",%d,%d); ",canvas_root_id,GRID_CANVAS,line_width,stroke_color,fill_color,stroke_opacity,fill_opacity,font_size,font_family,font_color,use_axis_numbering,precision);
2626
                        fprintf(js_include_file,"use_xlogscale=1;use_ylogscale=1;snap_x = xlogbase;snap_y = ylogbase;");
2625
                        fprintf(js_include_file,"use_xlogscale=1;use_ylogscale=1;snap_x = xlogbase;snap_y = ylogbase;");
2627
                        add_to_buffer(tmp_buffer);
2626
                        add_to_buffer(tmp_buffer);
2628
                        break;
2627
                        break;
2629
                    default:break;
2628
                    default:break;
2630
                }
2629
                }
Line 5549... Line 5548...
5549
 return;\
5548
 return;\
5550
};",canvas_root_id,canvas_root_id,canvas_root_id);
5549
};",canvas_root_id,canvas_root_id,canvas_root_id);
5551
    break;
5550
    break;
5552
case DRAW_XYLOGSCALE:
5551
case DRAW_XYLOGSCALE:
5553
fprintf(js_include_file,"\n<!-- draw xylogscale -->\n\
5552
fprintf(js_include_file,"\n<!-- draw xylogscale -->\n\
5554
draw_grid%d = function(canvas_type,line_width,major_color,minor_color,major_opacity,minor_opacity,font_size,font_family,font_color,use_axis_numbering){\n\
5553
draw_grid%d = function(canvas_type,line_width,major_color,minor_color,major_opacity,minor_opacity,font_size,font_family,font_color,use_axis_numbering,precision){\n\
5555
 var obj;\n\
5554
 var obj;\n\
5556
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\n\
5555
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\n\
5557
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\n\
5556
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\n\
5558
 }\n\
5557
 }\n\
5559
 else\n\
5558
 else\n\
Line 5649... Line 5648...
5649
};",canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id);
5648
};",canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id);
5650
    break;
5649
    break;
5651
 
5650
 
5652
case DRAW_XLOGSCALE:
5651
case DRAW_XLOGSCALE:
5653
fprintf(js_include_file,"\n<!-- draw xlogscale -->\n\
5652
fprintf(js_include_file,"\n<!-- draw xlogscale -->\n\
5654
draw_grid%d = function(canvas_type,line_width,major_color,minor_color,major_opacity,minor_opacity,font_size,font_family,font_color,use_axis_numbering,ymajor,yminor){\n\
5653
draw_grid%d = function(canvas_type,line_width,major_color,minor_color,major_opacity,minor_opacity,font_size,font_family,font_color,use_axis_numbering,ymajor,yminor,precision){\n\
5655
 var obj;\n\
5654
 var obj;\n\
5656
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\n\
5655
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\n\
5657
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\n\
5656
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\n\
5658
 }\n\
5657
 }\n\
5659
 else\n\
5658
 else\n\
Line 5752... Line 5751...
5752
 ctx.restore();\n\
5751
 ctx.restore();\n\
5753
};\n",canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id);
5752
};\n",canvas_root_id,canvas_root_id,canvas_root_id,canvas_root_id);
5754
    break;
5753
    break;
5755
case DRAW_YLOGSCALE:
5754
case DRAW_YLOGSCALE:
5756
fprintf(js_include_file,"\n<!-- draw ylogscale -->\n\
5755
fprintf(js_include_file,"\n<!-- draw ylogscale -->\n\
5757
draw_grid%d = function(canvas_type,line_width,major_color,minor_color,major_opacity,minor_opacity,font_size,font_family,font_color,use_axis_numbering,xmajor,xminor){\n\
5756
draw_grid%d = function(canvas_type,line_width,major_color,minor_color,major_opacity,minor_opacity,font_size,font_family,font_color,use_axis_numbering,xmajor,xminor,precision){\n\
5758
 var obj;\n\
5757
 var obj;\n\
5759
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\n\
5758
 if( document.getElementById(\"wims_canvas%d\"+canvas_type) ){\n\
5760
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\n\
5759
  obj = document.getElementById(\"wims_canvas%d\"+canvas_type);\n\
5761
 }\n\
5760
 }\n\
5762
 else\n\
5761
 else\n\