情報学部 菅沼ホーム 目次 索引

グラフの表示

    1. A. Java
    2. B. JavaScript

  このプログラムでは,棒グラフ,折れ線グラフ( 2 種類),積み上げ式棒グラフ,円グラフ,散布図,レーダーチャート,ボード線図を描くことができます.また,表示画面の大きさを変えることも可能です.さらに,右上の「横」または「縦」と記述された部分をクリックすると縦表示と横表示が切り替わります.同様に,「色」と記述された部分をクリックすることによって,グラフの色,折れ線グラフ等の線の太さやマークの有無等を変更することができます.

  1. Java

    /****************************/
    /* グラフの描画             */
    /*      coded by Y.Suganuma */
    /****************************/
    import java.io.*;
    import java.text.*;
    import java.awt.*;
    import java.awt.event.*;
    
    public class Test {
    
    	public static void main(String args[])
    	{
    		Menu menu = new Menu("グラフの選択");
    	}
    }
    
    /****************************/
    /* グラフの選択             */
    /*      coded by Y.Suganuma */
    /****************************/
    class Menu extends Frame implements ActionListener
    {
    
    	String title[];   // グラフ,x軸,及び,y軸のタイトル
    	String g_title[];   // 凡例(グラフの内容)
    	String x_title[];   // x軸への表示
    	double x_scale[];   // x軸目盛り
    	double y_scale[];   // y軸目盛り
    	double data_x[][], data_y[][];   // データ
    	Checkbox c1, c2, c3, c4, c5, c6, c7, c8;
    
    	/******************/
    	/* コンストラクタ */
    	/******************/
    	Menu(String name)
    	{
    					// Frameクラスのコンストラクタの呼び出し
    		super(name);
    					// Windowサイズ,レイアウト,フォント
    		setSize(600, 300);
    		setLayout(new BorderLayout(10, 10));
    		setFont(new Font("MS明朝", Font.PLAIN, 20));
    					// ラジオボタン
    		Panel pn1 = new Panel();
    		add(pn1, BorderLayout.CENTER);
    		pn1.setLayout(new GridLayout(4, 2, 10, 10));
    		CheckboxGroup cbg = new CheckboxGroup();
    		c1 = new Checkbox("棒グラフ", cbg, true);
    		pn1.add(c1);
    		c2 = new Checkbox("折れ線グラフ(1)", cbg, false);
    		pn1.add(c2);
    		c3 = new Checkbox("折れ線グラフ(2)", cbg, false);
    		pn1.add(c3);
    		c4 = new Checkbox("積み上げ棒グラフ", cbg, false);
    		pn1.add(c4);
    		c5 = new Checkbox("円グラフ", cbg, false);
    		pn1.add(c5);
    		c6 = new Checkbox("散布図", cbg, false);
    		pn1.add(c6);
    		c7 = new Checkbox("レーダーチャート", cbg, false);
    		pn1.add(c7);
    		c8 = new Checkbox("ボード線図(片対数グラフ)", cbg, false);
    		pn1.add(c8);
    					// ボタン
    		Panel pn2 = new Panel();
    		add(pn2, BorderLayout.SOUTH);
    		Button bt = new Button("描画");
    		bt.setBackground(Color.pink);
    		bt.addActionListener(this);
    		pn2.add(bt);
    					// ウィンドウを表示
    		setVisible(true);
    					// イベントアダプタ
    		addWindowListener(new WinEnd());
    	}
    
    	/******************************/
    	/* 上,左,下,右の余白の設定 */
    	/******************************/
    	public Insets getInsets()
    	{
    		return new Insets(70, 20, 20, 20);
    	}
    
    	/******************************/
    	/* ボタンが押されたときの処理 */
    	/******************************/
    	public void actionPerformed(ActionEvent e)
    	{
    					//
    					// 棒グラフ
    					//
    		if (c1.getState()) {
    						// グラフ,x軸,及び,y軸のタイトル
    			title = new String [3];
    			title[0] = "棒グラフの例";
    			title[1] = "x軸タイトル";
    			title[2] = "y軸タイトル";
    						// 凡例(グラフの内容)
    			g_title = new String [6];
    			g_title[0] = "自己啓発";
    			g_title[1] = "目的意識";
    			g_title[2] = "国際感覚";
    			g_title[3] = "実行力";
    			g_title[4] = "創造力";
    			g_title[5] = "交渉力・調整力・コミュニケーション";
    						// x軸への表示
    			x_title = new String [5];
    			x_title[0] = "非常に重視する";
    			x_title[1] = "やや重視する";
    			x_title[2] = "普通";
    			x_title[3] = "あまり考慮しない";
    			x_title[4] = "全く考慮しない";
    						// y軸目盛り
    			y_scale = new double[3];
    			y_scale[0] = 0.0;   // 最小値
    			y_scale[1] = 200.0;   // 最大値
    			y_scale[2] = 50.0;   // 刻み幅
    						// データ
    			data_y = new double [6][5];
    			data_y[0][0] = 114;
    			data_y[0][1] = 146;
    			data_y[0][2] = 40;
    			data_y[0][3] = 0;
    			data_y[0][4] = 0;
    			data_y[1][0] = 144;
    			data_y[1][1] = 130;
    			data_y[1][2] = 24;
    			data_y[1][3] = 0;
    			data_y[1][4] = 1;
    			data_y[2][0] = 10;
    			data_y[2][1] = 56;
    			data_y[2][2] = 160;
    			data_y[2][3] = 36;
    			data_y[2][4] = 15;
    			data_y[3][0] = 179;
    			data_y[3][1] = 100;
    			data_y[3][2] = 21;
    			data_y[3][3] = 0;
    			data_y[3][4] = 0;
    			data_y[4][0] = 101;
    			data_y[4][1] = 141;
    			data_y[4][2] = 46;
    			data_y[4][3] = 0;
    			data_y[4][4] = 1;
    			data_y[5][0] = 131;
    			data_y[5][1] = 104;
    			data_y[5][2] = 60;
    			data_y[5][3] = 1;
    			data_y[5][4] = 0;
    						// 作図
    			BarGraph gp = new BarGraph(title, g_title, x_title, y_scale, 0, data_y, true, true);
    		}
    					//
    					// 折れ線グラフ(1)
    					//
    		else if (c2.getState()) {
    						// グラフ,x軸,及び,y軸のタイトル
    			title = new String [3];
    			title[0] = "折れ線グラフの例(1)";
    			title[1] = "x軸タイトル";
    			title[2] = "y軸タイトル";
    						// 凡例(グラフの内容)
    			g_title = new String [6];
    			g_title[0] = "自己啓発";
    			g_title[1] = "目的意識";
    			g_title[2] = "国際感覚";
    			g_title[3] = "実行力";
    			g_title[4] = "創造力";
    			g_title[5] = "交渉力・調整力・コミュニケーション";
    						// x軸への表示
    			x_title = new String [5];
    			x_title[0] = "非常に重視する";
    			x_title[1] = "やや重視する";
    			x_title[2] = "普通";
    			x_title[3] = "あまり考慮しない";
    			x_title[4] = "全く考慮しない";
    						// y軸目盛り
    			y_scale = new double[3];
    			y_scale[0] = 0.0;   // 最小値
    			y_scale[1] = 200.0;   // 最大値
    			y_scale[2] = 50.0;   // 刻み幅
    						// データ
    			data_y = new double [6][5];
    			data_y[0][0] = 114;
    			data_y[0][1] = 146;
    			data_y[0][2] = 40;
    			data_y[0][3] = 0;
    			data_y[0][4] = 0;
    			data_y[1][0] = 144;
    			data_y[1][1] = 130;
    			data_y[1][2] = 24;
    			data_y[1][3] = 0;
    			data_y[1][4] = 1;
    			data_y[2][0] = 10;
    			data_y[2][1] = 56;
    			data_y[2][2] = 160;
    			data_y[2][3] = 36;
    			data_y[2][4] = 15;
    			data_y[3][0] = 179;
    			data_y[3][1] = 100;
    			data_y[3][2] = 21;
    			data_y[3][3] = 0;
    			data_y[3][4] = 0;
    			data_y[4][0] = 101;
    			data_y[4][1] = 141;
    			data_y[4][2] = 46;
    			data_y[4][3] = 0;
    			data_y[4][4] = 1;
    			data_y[5][0] = 131;
    			data_y[5][1] = 104;
    			data_y[5][2] = 60;
    			data_y[5][3] = 1;
    			data_y[5][4] = 0;
    						// 作図
    			LineGraph gp = new LineGraph(title, g_title, x_title, y_scale, 0, data_y, true, true);
    		}
    					//
    					// 折れ線グラフ(2)
    					//
    		else if (c3.getState()) {
    						// グラフ,x軸,及び,y軸のタイトル
    			title = new String [3];
    			title[0] = "折れ線グラフの例(2)";
    			title[1] = "x軸タイトル";
    			title[2] = "y軸タイトル";
    						// 凡例(グラフの内容)
    			g_title = new String [3];
    			g_title[0] = "自己啓発";
    			g_title[1] = "目的意識";
    			g_title[2] = "国際感覚";
    						// x軸目盛り
    			x_scale = new double[3];
    			x_scale[0] = 0.0;   // 最小値
    			x_scale[1] = 100.0;   // 最大値
    			x_scale[2] = 20.0;   // 刻み幅
    						// y軸目盛り
    			y_scale = new double[3];
    			y_scale[0] = 0.0;   // 最小値
    			y_scale[1] = 200.0;   // 最大値
    			y_scale[2] = 50.0;   // 刻み幅
    						// データ
    			data_x = new double [3][4];
    			data_y = new double [3][4];
    			data_x[0][0] = 0;
    			data_x[0][1] = 14;
    			data_x[0][2] = 40;
    			data_x[0][3] = 100;
    			data_x[1][0] = 0;
    			data_x[1][1] = 30;
    			data_x[1][2] = 34;
    			data_x[1][3] = 100;
    			data_x[2][0] = 0;
    			data_x[2][1] = 56;
    			data_x[2][2] = 60;
    			data_x[2][3] = 100;
    			data_y[0][0] = 179;
    			data_y[0][1] = 100;
    			data_y[0][2] = 21;
    			data_y[0][3] = 0;
    			data_y[1][0] = 101;
    			data_y[1][1] = 141;
    			data_y[1][2] = 46;
    			data_y[1][3] = 10;
    			data_y[2][0] = 131;
    			data_y[2][1] = 104;
    			data_y[2][2] = 60;
    			data_y[2][3] = 100;
    						// 作図
    			LineGraph gp = new LineGraph(title, g_title, x_scale, 1, y_scale, 0, data_x, data_y, true, true);
    		}
    					//
    					// 積み上げ棒グラフ
    					//
    		else if (c4.getState()) {
    						// グラフのタイトル
    			title = new String [3];
    			title[0] = "積み上げ棒グラフの例(全体:300人)";
    			title[1] = "x軸タイトル";
    			title[2] = "y軸タイトル";
    						// グラフの内容
    			g_title = new String [21];
    			g_title[0] = "自己啓発";
    			g_title[1] = "目的意識";
    			g_title[2] = "国際感覚";
    			g_title[3] = "実行力";
    			g_title[4] = "創造力";
    			g_title[5] = "交渉力・調整力・コミュニケーション";
    			g_title[6] = "情報収集力";
    			g_title[7] = "プレゼンテーション能力";
    			g_title[8] = "積極性・自主性・チャレンジ精神";
    			g_title[9] = "柔軟性・協調性";
    			g_title[10] = "好奇心・探求心";
    			g_title[11] = "持続力・忍耐力";
    			g_title[12] = "責任感";
    			g_title[13] = "明朗さ";
    			g_title[14] = "真面目さ";
    			g_title[15] = "基礎学力(数学・物理等)";
    			g_title[16] = "専門知識";
    			g_title[17] = "専門技術";
    			g_title[18] = "日本語(文章読解・文章作成)";
    			g_title[19] = "英語";
    			g_title[20] = "コンピュータ・情報処理";
    						// 項目(凡例)
    			x_title = new String [5];
    			x_title[0] = "非常に重視する";
    			x_title[1] = "やや重視する";
    			x_title[2] = "普通";
    			x_title[3] = "あまり考慮しない";
    			x_title[4] = "全く考慮しない";
    						// y軸目盛り
    			y_scale = new double[3];
    			y_scale[0] = 0.0;   // 最小値
    			y_scale[1] = 100.0;   // 最大値
    			y_scale[2] = 20.0;   // 刻み幅
    						// データ
    			data_y = new double [21][5];
    			data_y[0][0] = 114;
    			data_y[0][1] = 146;
    			data_y[0][2] = 40;
    			data_y[0][3] = 0;
    			data_y[0][4] = 0;
    			data_y[1][0] = 144;
    			data_y[1][1] = 130;
    			data_y[1][2] = 24;
    			data_y[1][3] = 0;
    			data_y[1][4] = 1;
    			data_y[2][0] = 10;
    			data_y[2][1] = 56;
    			data_y[2][2] = 160;
    			data_y[2][3] = 36;
    			data_y[2][4] = 15;
    			data_y[3][0] = 179;
    			data_y[3][1] = 100;
    			data_y[3][2] = 21;
    			data_y[3][3] = 0;
    			data_y[3][4] = 0;
    			data_y[4][0] = 101;
    			data_y[4][1] = 141;
    			data_y[4][2] = 46;
    			data_y[4][3] = 0;
    			data_y[4][4] = 1;
    			data_y[5][0] = 131;
    			data_y[5][1] = 104;
    			data_y[5][2] = 60;
    			data_y[5][3] = 1;
    			data_y[5][4] = 0;
    			data_y[6][0] = 55;
    			data_y[6][1] = 122;
    			data_y[6][2] = 107;
    			data_y[6][3] = 5;
    			data_y[6][4] = 1;
    			data_y[7][0] = 43;
    			data_y[7][1] = 95;
    			data_y[7][2] = 132;
    			data_y[7][3] = 13;
    			data_y[7][4] = 3;
    			data_y[8][0] = 215;
    			data_y[8][1] = 75;
    			data_y[8][2] = 11;
    			data_y[8][3] = 0;
    			data_y[8][4] = 0;
    			data_y[9][0] = 115;
    			data_y[9][1] = 142;
    			data_y[9][2] = 41;
    			data_y[9][3] = 0;
    			data_y[9][4] = 0;
    			data_y[10][0] = 87;
    			data_y[10][1] = 139;
    			data_y[10][2] = 61;
    			data_y[10][3] = 2;
    			data_y[10][4] = 1;
    			data_y[11][0] = 116;
    			data_y[11][1] = 141;
    			data_y[11][2] = 39;
    			data_y[11][3] = 0;
    			data_y[11][4] = 1;
    			data_y[12][0] = 172;
    			data_y[12][1] = 107;
    			data_y[12][2] = 23;
    			data_y[12][3] = 0;
    			data_y[12][4] = 1;
    			data_y[13][0] = 106;
    			data_y[13][1] = 122;
    			data_y[13][2] = 67;
    			data_y[13][3] = 2;
    			data_y[13][4] = 1;
    			data_y[14][0] = 115;
    			data_y[14][1] = 107;
    			data_y[14][2] = 68;
    			data_y[14][3] = 3;
    			data_y[14][4] = 1;
    			data_y[15][0] = 43;
    			data_y[15][1] = 116;
    			data_y[15][2] = 121;
    			data_y[15][3] = 12;
    			data_y[15][4] = 3;
    			data_y[16][0] = 44;
    			data_y[16][1] = 104;
    			data_y[16][2] = 124;
    			data_y[16][3] = 13;
    			data_y[16][4] = 7;
    			data_y[17][0] = 41;
    			data_y[17][1] = 99;
    			data_y[17][2] = 125;
    			data_y[17][3] = 16;
    			data_y[17][4] = 8;
    			data_y[18][0] = 32;
    			data_y[18][1] = 98;
    			data_y[18][2] = 150;
    			data_y[18][3] = 6;
    			data_y[18][4] = 3;
    			data_y[19][0] = 9;
    			data_y[19][1] = 48;
    			data_y[19][2] = 158;
    			data_y[19][3] = 50;
    			data_y[19][4] = 17;
    			data_y[20][0] = 46;
    			data_y[20][1] = 106;
    			data_y[20][2] = 128;
    			data_y[20][3] = 13;
    			data_y[20][4] = 1;
    
    			int i1, i2;
    			double s;
    			for (i1 = 0; i1 < 21; i1++) {
    				s = 0.0;
    				for (i2 = 0; i2 < 5; i2++)
    					s += data_y[i1][i2];
    				for (i2 = 0; i2 < 5; i2++)
    					data_y[i1][i2] = data_y[i1][i2] / s * 100.0;
    			}
    						// 作図
    			StackGraph gp = new StackGraph(title, g_title, x_title, y_scale, 0, data_y, true);
    		}
    					//
    					// 円グラフ
    					//
    		else if (c5.getState()) {
    						// グラフのタイトル
    			title = new String [1];
    			title[0] = "円グラフの例(全体:277人)";
    						// 凡例
    			x_title = new String [5];
    			x_title[0] = "非常に重視する";
    			x_title[1] = "やや重視する";
    			x_title[2] = "普通";
    			x_title[3] = "あまり考慮しない";
    			x_title[4] = "全く考慮しない";
    						// データ
    			data_y = new double [6][5];
    			data_y[2][0] = 10;
    			data_y[2][1] = 56;
    			data_y[2][2] = 160;
    			data_y[2][3] = 36;
    			data_y[2][4] = 15;
    
    			int i1;
    			double s = 0.0;
    			for (i1 = 0; i1 < 5; i1++)
    				s += data_y[2][i1];
    			for (i1 = 0; i1 < 5; i1++)
    				data_y[2][i1] = data_y[2][i1] / s * 100.0;
    						// 作図
    			PieGraph gp = new PieGraph(title[0], x_title, data_y[2], true);
    		}
    					//
    					// 散布図
    					//
    		else if (c6.getState()) {
    						// グラフ,x軸,及び,y軸のタイトル
    			title = new String [3];
    			title[0] = "散布図の例";
    			title[1] = "x軸タイトル";
    			title[2] = "y軸タイトル";
    						// y軸目盛り
    			x_scale = new double[3];
    			x_scale[0] = 0.0;   // 最小値
    			x_scale[1] = 150.0;   // 最大値
    			x_scale[2] = 30.0;   // 刻み幅
    						// y軸目盛り
    			y_scale = new double[3];
    			y_scale[0] = 0.0;   // 最小値
    			y_scale[1] = 200.0;   // 最大値
    			y_scale[2] = 50.0;   // 刻み幅
    						// データ
    			data_y = new double [2][10];
    			data_y[0][0] = 11;
    			data_y[0][1] = 146;
    			data_y[0][2] = 40;
    			data_y[0][3] = 70;
    			data_y[0][4] = 100;
    			data_y[0][5] = 120;
    			data_y[0][6] = 50;
    			data_y[0][7] = 130;
    			data_y[0][8] = 80;
    			data_y[0][9] = 130;
    			data_y[1][0] = 17;
    			data_y[1][1] = 170;
    			data_y[1][2] = 21;
    			data_y[1][3] = 80;
    			data_y[1][4] = 140;
    			data_y[1][5] = 100;
    			data_y[1][6] = 80;
    			data_y[1][7] = 190;
    			data_y[1][8] = 60;
    			data_y[1][9] = 180;
    						// 作図
    			ScatterDiagram gp = new ScatterDiagram(title, x_scale, y_scale, 0, 0, data_y, true);
    		}
    					//
    					// レーダーチャート
    					//
    		else if (c7.getState()) {
    						// グラフ,x軸,及び,y軸のタイトル
    			title = new String [1];
    			title[0] = "レーダーチャートの例";
    						// 凡例(グラフの内容)
    			g_title = new String [2];
    			g_title[0] = "重要度";
    			g_title[1] = "評価";
    						// 項目
    			x_title = new String [21];
    			x_title[0] = "自己啓発";
    			x_title[1] = "目的意識";
    			x_title[2] = "国際感覚";
    			x_title[3] = "実行力";
    			x_title[4] = "創造力";
    			x_title[5] = "交渉力・調整力・コミュニケーション";
    			x_title[6] = "情報収集力";
    			x_title[7] = "プレゼンテーション能力";
    			x_title[8] = "積極性・自主性・チャレンジ精神";
    			x_title[9] = "柔軟性・協調性";
    			x_title[10] = "好奇心・探求心";
    			x_title[11] = "持続力・忍耐力";
    			x_title[12] = "責任感";
    			x_title[13] = "明朗さ";
    			x_title[14] = "真面目さ";
    			x_title[15] = "基礎学力(数学・物理等)";
    			x_title[16] = "専門知識";
    			x_title[17] = "専門技術";
    			x_title[18] = "日本語(文章読解・文章作成)";
    			x_title[19] = "英語";
    			x_title[20] = "コンピュータ・情報処理";
    						// 目盛り
    			y_scale = new double[3];
    			y_scale[0] = 1.0;   // 最小値
    			y_scale[1] = 5.0;   // 最大値
    			y_scale[2] = 1.0;   // 刻み幅
    						// データ
    			data_y = new double [2][21];
    			data_y[0][0] = 4.2;
    			data_y[0][1] = 4.4;
    			data_y[0][2] = 3.0;
    			data_y[0][3] = 4.5;
    			data_y[0][4] = 4.2;
    			data_y[0][5] = 4.2;
    			data_y[0][6] = 3.8;
    			data_y[0][7] = 3.6;
    			data_y[0][8] = 4.7;
    			data_y[0][9] = 4.2;
    			data_y[0][10] = 4.1;
    			data_y[0][11] = 4.2;
    			data_y[0][12] = 4.5;
    			data_y[0][13] = 4.1;
    			data_y[0][14] = 4.1;
    			data_y[0][15] = 3.6;
    			data_y[0][16] = 3.6;
    			data_y[0][17] = 3.5;
    			data_y[0][18] = 3.5;
    			data_y[0][19] = 2.9;
    			data_y[0][20] = 3.6;
    			data_y[1][0] = 3.4;
    			data_y[1][1] = 3.5;
    			data_y[1][2] = 2.7;
    			data_y[1][3] = 3.5;
    			data_y[1][4] = 3.2;
    			data_y[1][5] = 3.2;
    			data_y[1][6] = 3.1;
    			data_y[1][7] = 2.9;
    			data_y[1][8] = 3.4;
    			data_y[1][9] = 3.6;
    			data_y[1][10] = 3.3;
    			data_y[1][11] = 3.6;
    			data_y[1][12] = 3.8;
    			data_y[1][13] = 3.5;
    			data_y[1][14] = 4.0;
    			data_y[1][15] = 3.3;
    			data_y[1][16] = 3.2;
    			data_y[1][17] = 3.2;
    			data_y[1][18] = 3.1;
    			data_y[1][19] = 2.7;
    			data_y[1][20] = 3.4;
    						// 作図
    			RadarChart gp = new RadarChart(title[0], g_title, x_title, y_scale, 1, data_y, true, true);
    		}
    					//
    					// ボード線図(片対数グラフ)
    					//
    		else {
    						// グラフ,x軸,及び,y軸のタイトル
    			title = new String [3];
    			title[0] = "ボード線図の例";
    			title[1] = "角周波数";
    			title[2] = "ゲイン(dB)";
    						// 凡例(グラフの内容)
    			g_title = new String [2];
    			g_title[0] = "一次遅れ要素";
    			g_title[1] = "二次遅れ要素";
    						// x軸目盛り
    			x_scale = new double[3];
    			x_scale[0] = 0.01;   // 最小値
    			x_scale[1] = 100.0;   // 最大値
    			x_scale[2] = 1.0;   // 最大値
    						// y軸目盛り
    			y_scale = new double[3];
    			y_scale[0] = -80.0;   // 最小値
    			y_scale[1] = 20.0;   // 最大値
    			y_scale[2] = 20.0;   // 刻み幅
    						// データ
    			data_x = new double [2][101];
    			data_y = new double [2][101];
    			data_x[0][0] = 0.01;
    			data_x[0][1] = 0.0109647819614318;
    			data_x[0][2] = 0.0120226443461741;
    			data_x[0][3] = 0.013182567385564;
    			data_x[0][4] = 0.0144543977074592;
    			data_x[0][5] = 0.0158489319246111;
    			data_x[0][6] = 0.0173780082874937;
    			data_x[0][7] = 0.0190546071796325;
    			data_x[0][8] = 0.0208929613085404;
    			data_x[0][9] = 0.0229086765276777;
    			data_x[0][10] = 0.0251188643150958;
    			data_x[0][11] = 0.0275422870333817;
    			data_x[0][12] = 0.0301995172040202;
    			data_x[0][13] = 0.0331131121482591;
    			data_x[0][14] = 0.0363078054770102;
    			data_x[0][15] = 0.0398107170553498;
    			data_x[0][16] = 0.0436515832240167;
    			data_x[0][17] = 0.0478630092322639;
    			data_x[0][18] = 0.0524807460249773;
    			data_x[0][19] = 0.0575439937337158;
    			data_x[0][20] = 0.0630957344480195;
    			data_x[0][21] = 0.0691830970918938;
    			data_x[0][22] = 0.0758577575029186;
    			data_x[0][23] = 0.0831763771102673;
    			data_x[0][24] = 0.0912010839355912;
    			data_x[0][25] = 0.1;
    			data_x[0][26] = 0.109647819614318;
    			data_x[0][27] = 0.120226443461741;
    			data_x[0][28] = 0.131825673855641;
    			data_x[0][29] = 0.144543977074593;
    			data_x[0][30] = 0.158489319246111;
    			data_x[0][31] = 0.173780082874938;
    			data_x[0][32] = 0.190546071796325;
    			data_x[0][33] = 0.208929613085404;
    			data_x[0][34] = 0.229086765276778;
    			data_x[0][35] = 0.251188643150959;
    			data_x[0][36] = 0.275422870333817;
    			data_x[0][37] = 0.301995172040202;
    			data_x[0][38] = 0.331131121482592;
    			data_x[0][39] = 0.363078054770102;
    			data_x[0][40] = 0.398107170553498;
    			data_x[0][41] = 0.436515832240167;
    			data_x[0][42] = 0.47863009232264;
    			data_x[0][43] = 0.524807460249774;
    			data_x[0][44] = 0.575439937337159;
    			data_x[0][45] = 0.630957344480195;
    			data_x[0][46] = 0.691830970918939;
    			data_x[0][47] = 0.758577575029186;
    			data_x[0][48] = 0.831763771102674;
    			data_x[0][49] = 0.912010839355913;
    			data_x[0][50] = 1;
    			data_x[0][51] = 1.09647819614318;
    			data_x[0][52] = 1.20226443461741;
    			data_x[0][53] = 1.31825673855641;
    			data_x[0][54] = 1.44543977074593;
    			data_x[0][55] = 1.58489319246111;
    			data_x[0][56] = 1.73780082874938;
    			data_x[0][57] = 1.90546071796325;
    			data_x[0][58] = 2.08929613085404;
    			data_x[0][59] = 2.29086765276778;
    			data_x[0][60] = 2.51188643150958;
    			data_x[0][61] = 2.75422870333817;
    			data_x[0][62] = 3.01995172040202;
    			data_x[0][63] = 3.31131121482592;
    			data_x[0][64] = 3.63078054770102;
    			data_x[0][65] = 3.98107170553498;
    			data_x[0][66] = 4.36515832240167;
    			data_x[0][67] = 4.7863009232264;
    			data_x[0][68] = 5.24807460249774;
    			data_x[0][69] = 5.75439937337159;
    			data_x[0][70] = 6.30957344480195;
    			data_x[0][71] = 6.91830970918939;
    			data_x[0][72] = 7.58577575029186;
    			data_x[0][73] = 8.31763771102674;
    			data_x[0][74] = 9.12010839355913;
    			data_x[0][75] = 10;
    			data_x[0][76] = 10.9647819614318;
    			data_x[0][77] = 12.0226443461741;
    			data_x[0][78] = 13.1825673855641;
    			data_x[0][79] = 14.4543977074593;
    			data_x[0][80] = 15.8489319246112;
    			data_x[0][81] = 17.3780082874938;
    			data_x[0][82] = 19.0546071796325;
    			data_x[0][83] = 20.8929613085404;
    			data_x[0][84] = 22.9086765276778;
    			data_x[0][85] = 25.1188643150959;
    			data_x[0][86] = 27.5422870333818;
    			data_x[0][87] = 30.1995172040203;
    			data_x[0][88] = 33.1131121482592;
    			data_x[0][89] = 36.3078054770103;
    			data_x[0][90] = 39.8107170553499;
    			data_x[0][91] = 43.6515832240168;
    			data_x[0][92] = 47.8630092322641;
    			data_x[0][93] = 52.4807460249775;
    			data_x[0][94] = 57.543993733716;
    			data_x[0][95] = 63.0957344480196;
    			data_x[0][96] = 69.183097091894;
    			data_x[0][97] = 75.8577575029188;
    			data_x[0][98] = 83.1763771102676;
    			data_x[0][99] = 91.2010839355915;
    			data_x[0][100] = 100;
    			data_x[1][0] = 0.01;
    			data_x[1][1] = 0.0109647819614318;
    			data_x[1][2] = 0.0120226443461741;
    			data_x[1][3] = 0.013182567385564;
    			data_x[1][4] = 0.0144543977074592;
    			data_x[1][5] = 0.0158489319246111;
    			data_x[1][6] = 0.0173780082874937;
    			data_x[1][7] = 0.0190546071796325;
    			data_x[1][8] = 0.0208929613085404;
    			data_x[1][9] = 0.0229086765276777;
    			data_x[1][10] = 0.0251188643150958;
    			data_x[1][11] = 0.0275422870333817;
    			data_x[1][12] = 0.0301995172040202;
    			data_x[1][13] = 0.0331131121482591;
    			data_x[1][14] = 0.0363078054770102;
    			data_x[1][15] = 0.0398107170553498;
    			data_x[1][16] = 0.0436515832240167;
    			data_x[1][17] = 0.0478630092322639;
    			data_x[1][18] = 0.0524807460249773;
    			data_x[1][19] = 0.0575439937337158;
    			data_x[1][20] = 0.0630957344480195;
    			data_x[1][21] = 0.0691830970918938;
    			data_x[1][22] = 0.0758577575029186;
    			data_x[1][23] = 0.0831763771102673;
    			data_x[1][24] = 0.0912010839355912;
    			data_x[1][25] = 0.1;
    			data_x[1][26] = 0.109647819614318;
    			data_x[1][27] = 0.120226443461741;
    			data_x[1][28] = 0.131825673855641;
    			data_x[1][29] = 0.144543977074593;
    			data_x[1][30] = 0.158489319246111;
    			data_x[1][31] = 0.173780082874938;
    			data_x[1][32] = 0.190546071796325;
    			data_x[1][33] = 0.208929613085404;
    			data_x[1][34] = 0.229086765276778;
    			data_x[1][35] = 0.251188643150959;
    			data_x[1][36] = 0.275422870333817;
    			data_x[1][37] = 0.301995172040202;
    			data_x[1][38] = 0.331131121482592;
    			data_x[1][39] = 0.363078054770102;
    			data_x[1][40] = 0.398107170553498;
    			data_x[1][41] = 0.436515832240167;
    			data_x[1][42] = 0.47863009232264;
    			data_x[1][43] = 0.524807460249774;
    			data_x[1][44] = 0.575439937337159;
    			data_x[1][45] = 0.630957344480195;
    			data_x[1][46] = 0.691830970918939;
    			data_x[1][47] = 0.758577575029186;
    			data_x[1][48] = 0.831763771102674;
    			data_x[1][49] = 0.912010839355913;
    			data_x[1][50] = 1;
    			data_x[1][51] = 1.09647819614318;
    			data_x[1][52] = 1.20226443461741;
    			data_x[1][53] = 1.31825673855641;
    			data_x[1][54] = 1.44543977074593;
    			data_x[1][55] = 1.58489319246111;
    			data_x[1][56] = 1.73780082874938;
    			data_x[1][57] = 1.90546071796325;
    			data_x[1][58] = 2.08929613085404;
    			data_x[1][59] = 2.29086765276778;
    			data_x[1][60] = 2.51188643150958;
    			data_x[1][61] = 2.75422870333817;
    			data_x[1][62] = 3.01995172040202;
    			data_x[1][63] = 3.31131121482592;
    			data_x[1][64] = 3.63078054770102;
    			data_x[1][65] = 3.98107170553498;
    			data_x[1][66] = 4.36515832240167;
    			data_x[1][67] = 4.7863009232264;
    			data_x[1][68] = 5.24807460249774;
    			data_x[1][69] = 5.75439937337159;
    			data_x[1][70] = 6.30957344480195;
    			data_x[1][71] = 6.91830970918939;
    			data_x[1][72] = 7.58577575029186;
    			data_x[1][73] = 8.31763771102674;
    			data_x[1][74] = 9.12010839355913;
    			data_x[1][75] = 10;
    			data_x[1][76] = 10.9647819614318;
    			data_x[1][77] = 12.0226443461741;
    			data_x[1][78] = 13.1825673855641;
    			data_x[1][79] = 14.4543977074593;
    			data_x[1][80] = 15.8489319246112;
    			data_x[1][81] = 17.3780082874938;
    			data_x[1][82] = 19.0546071796325;
    			data_x[1][83] = 20.8929613085404;
    			data_x[1][84] = 22.9086765276778;
    			data_x[1][85] = 25.1188643150959;
    			data_x[1][86] = 27.5422870333818;
    			data_x[1][87] = 30.1995172040203;
    			data_x[1][88] = 33.1131121482592;
    			data_x[1][89] = 36.3078054770103;
    			data_x[1][90] = 39.8107170553499;
    			data_x[1][91] = 43.6515832240168;
    			data_x[1][92] = 47.8630092322641;
    			data_x[1][93] = 52.4807460249775;
    			data_x[1][94] = 57.543993733716;
    			data_x[1][95] = 63.0957344480196;
    			data_x[1][96] = 69.183097091894;
    			data_x[1][97] = 75.8577575029188;
    			data_x[1][98] = 83.1763771102676;
    			data_x[1][99] = 91.2010839355915;
    			data_x[1][100] = 100;
    			data_y[0][0] = -0.00043427276862636;
    			data_y[0][1] = -0.000522105424932322;
    			data_y[0][2] = -0.000627701152241214;
    			data_y[0][3] = -0.000754651740749838;
    			data_y[0][4] = -0.000907275005683991;
    			data_y[0][5] = -0.00109076142866441;
    			data_y[0][6] = -0.00131135036701045;
    			data_y[0][7] = -0.0015765417703246;
    			data_y[0][8] = -0.00189535052688523;
    			data_y[0][9] = -0.00227861197648364;
    			data_y[0][10] = -0.00273934881496565;
    			data_y[0][11] = -0.00329321162892171;
    			data_y[0][12] = -0.00395900769500453;
    			data_y[0][13] = -0.00475933552387765;
    			data_y[0][14] = -0.00572134599940977;
    			data_y[0][15] = -0.00687765494318666;
    			data_y[0][16] = -0.00826743661415132;
    			data_y[0][17] = -0.00993773312918616;
    			data_y[0][18] = -0.0119450211581656;
    			data_y[0][19] = -0.014357084593869;
    			data_y[0][20] = -0.017255250287929;
    			data_y[0][21] = -0.0207370534016865;
    			data_y[0][22] = -0.0249194093944646;
    			data_y[0][23] = -0.0299423809918071;
    			data_y[0][24] = -0.0359736402894658;
    			data_y[0][25] = -0.0432137378264255;
    			data_y[0][26] = -0.051902300972248;
    			data_y[0][27] = -0.0623252917208117;
    			data_y[0][28] = -0.0748234565761777;
    			data_y[0][29] = -0.0898020952083107;
    			data_y[0][30] = -0.10774225511957;
    			data_y[0][31] = -0.129213420154599;
    			data_y[0][32] = -0.154887692755856;
    			data_y[0][33] = -0.185555362732532;
    			data_y[0][34] = -0.222141596415848;
    			data_y[0][35] = -0.265723755961027;
    			data_y[0][36] = -0.317548557029209;
    			data_y[0][37] = -0.379047887154574;
    			data_y[0][38] = -0.451851641314966;
    			data_y[0][39] = -0.537795410636778;
    			data_y[0][40] = -0.6389203414338;
    			data_y[0][41] = -0.757462064101649;
    			data_y[0][42] = -0.895825422443528;
    			data_y[0][43] = -1.05654200302736;
    			data_y[0][44] = -1.2422083724146;
    			data_y[0][45] = -1.45540463109294;
    			data_y[0][46] = -1.69859540490393;
    			data_y[0][47] = -1.97401850619972;
    			data_y[0][48] = -2.2835697095824;
    			data_y[0][49] = -2.62869465226149;
    			data_y[0][50] = -3.01029995663982;
    			data_y[0][51] = -3.42869465226149;
    			data_y[0][52] = -3.8835697095824;
    			data_y[0][53] = -4.37401850619973;
    			data_y[0][54] = -4.89859540490394;
    			data_y[0][55] = -5.45540463109295;
    			data_y[0][56] = -6.04220837241461;
    			data_y[0][57] = -6.65654200302738;
    			data_y[0][58] = -7.29582542244354;
    			data_y[0][59] = -7.95746206410166;
    			data_y[0][60] = -8.63892034143381;
    			data_y[0][61] = -9.33779541063679;
    			data_y[0][62] = -10.0518516413149;
    			data_y[0][63] = -10.7790478871545;
    			data_y[0][64] = -11.5175485570292;
    			data_y[0][65] = -12.265723755961;
    			data_y[0][66] = -13.0221415964158;
    			data_y[0][67] = -13.7855553627325;
    			data_y[0][68] = -14.5548876927558;
    			data_y[0][69] = -15.3292134201546;
    			data_y[0][70] = -16.1077422551196;
    			data_y[0][71] = -16.8898020952083;
    			data_y[0][72] = -17.6748234565762;
    			data_y[0][73] = -18.4623252917208;
    			data_y[0][74] = -19.2519023009722;
    			data_y[0][75] = -20.0432137378264;
    			data_y[0][76] = -20.8359736402895;
    			data_y[0][77] = -21.6299423809918;
    			data_y[0][78] = -22.4249194093944;
    			data_y[0][79] = -23.2207370534017;
    			data_y[0][80] = -24.0172552502879;
    			data_y[0][81] = -24.8143570845939;
    			data_y[0][82] = -25.6119450211582;
    			data_y[0][83] = -26.4099377331292;
    			data_y[0][84] = -27.2082674366141;
    			data_y[0][85] = -28.0068776549432;
    			data_y[0][86] = -28.8057213459994;
    			data_y[0][87] = -29.6047593355239;
    			data_y[0][88] = -30.403959007695;
    			data_y[0][89] = -31.2032932116289;
    			data_y[0][90] = -32.002739348815;
    			data_y[0][91] = -32.8022786119765;
    			data_y[0][92] = -33.6018953505269;
    			data_y[0][93] = -34.4015765417703;
    			data_y[0][94] = -35.201311350367;
    			data_y[0][95] = -36.0010907614287;
    			data_y[0][96] = -36.8009072750057;
    			data_y[0][97] = -37.6007546517408;
    			data_y[0][98] = -38.4006277011522;
    			data_y[0][99] = -39.2005221054249;
    			data_y[0][100] = -40.0004342727686;
    			data_y[1][0] = 0.000760038415382399;
    			data_y[1][1] = 0.000913772766359686;
    			data_y[1][2] = 0.00109860460812431;
    			data_y[1][3] = 0.00132082497033832;
    			data_y[1][4] = 0.0015879978301257;
    			data_y[1][5] = 0.00190921780497035;
    			data_y[1][6] = 0.00229542006615489;
    			data_y[1][7] = 0.00275975307888415;
    			data_y[1][8] = 0.00331802694011069;
    			data_y[1][9] = 0.00398925269639393;
    			data_y[1][10] = 0.00479629117620189;
    			data_y[1][11] = 0.00576663367903434;
    			data_y[1][12] = 0.0069333414679863;
    			data_y[1][13] = 0.00833617658612594;
    			data_y[1][14] = 0.0100229632730993;
    			data_y[1][15] = 0.0120512274603127;
    			data_y[1][16] = 0.0144901717990999;
    			data_y[1][17] = 0.0174230558361977;
    			data_y[1][18] = 0.0209500658109257;
    			data_y[1][19] = 0.0251917767617845;
    			data_y[1][20] = 0.0302933320307221;
    			data_y[1][21] = 0.0364294929122781;
    			data_y[1][22] = 0.043810745501032;
    			data_y[1][23] = 0.0526906945590592;
    			data_y[1][24] = 0.0633750278465736;
    			data_y[1][25] = 0.0762324020119698;
    			data_y[1][26] = 0.0917076870782207;
    			data_y[1][27] = 0.11033811653403;
    			data_y[1][28] = 0.132773031837264;
    			data_y[1][29] = 0.159798094398276;
    			data_y[1][30] = 0.192365079368509;
    			data_y[1][31] = 0.231628683657635;
    			data_y[1][32] = 0.278992202428454;
    			data_y[1][33] = 0.336164489672405;
    			data_y[1][34] = 0.405231365272613;
    			data_y[1][35] = 0.488745617523805;
    			data_y[1][36] = 0.589841028229403;
    			data_y[1][37] = 0.712377430460434;
    			data_y[1][38] = 0.861125568145392;
    			data_y[1][39] = 1.0420019107726;
    			data_y[1][40] = 1.26236286023883;
    			data_y[1][41] = 1.53136003903385;
    			data_y[1][42] = 1.86032983314904;
    			data_y[1][43] = 2.26310269847673;
    			data_y[1][44] = 2.7558619659877;
    			data_y[1][45] = 3.35544406114777;
    			data_y[1][46] = 4.07285867859558;
    			data_y[1][47] = 4.8930591948081;
    			data_y[1][48] = 5.71985312756973;
    			data_y[1][49] = 6.26638529740493;
    			data_y[1][50] = 6.02059991327959;
    			data_y[1][51] = 4.66638529740486;
    			data_y[1][52] = 2.51985312756961;
    			data_y[1][53] = 0.0930591948079767;
    			data_y[1][54] = -2.32714132140453;
    			data_y[1][55] = -4.64455593885234;
    			data_y[1][56] = -6.84413803401239;
    			data_y[1][57] = -8.93689730152335;
    			data_y[1][58] = -10.939670166851;
    			data_y[1][59] = -12.8686399609662;
    			data_y[1][60] = -14.7376371397612;
    			data_y[1][61] = -16.5579980892274;
    			data_y[1][62] = -18.3388744318546;
    			data_y[1][63] = -20.0876225695396;
    			data_y[1][64] = -21.8101589717706;
    			data_y[1][65] = -23.5112543824762;
    			data_y[1][66] = -25.1947686347274;
    			data_y[1][67] = -26.8638355103276;
    			data_y[1][68] = -28.5210077975716;
    			data_y[1][69] = -30.1683713163424;
    			data_y[1][70] = -31.8076349206315;
    			data_y[1][71] = -33.4402019056017;
    			data_y[1][72] = -35.0672269681628;
    			data_y[1][73] = -36.689661883466;
    			data_y[1][74] = -38.3082923129218;
    			data_y[1][75] = -39.9237675979881;
    			data_y[1][76] = -41.5366249721535;
    			data_y[1][77] = -43.147309305441;
    			data_y[1][78] = -44.756189254499;
    			data_y[1][79] = -46.3635705070877;
    			data_y[1][80] = -47.9697066679693;
    			data_y[1][81] = -49.5748082232382;
    			data_y[1][82] = -51.1790499341891;
    			data_y[1][83] = -52.7825769441638;
    			data_y[1][84] = -54.3855098282009;
    			data_y[1][85] = -55.9879487725397;
    			data_y[1][86] = -57.5899770367269;
    			data_y[1][87] = -59.1916638234139;
    			data_y[1][88] = -60.7930666585321;
    			data_y[1][89] = -62.394233366321;
    			data_y[1][90] = -63.9952037088238;
    			data_y[1][91] = -65.5960107473037;
    			data_y[1][92] = -67.1966819730599;
    			data_y[1][93] = -68.7972402469212;
    			data_y[1][94] = -70.3977045799339;
    			data_y[1][95] = -71.9980907821951;
    			data_y[1][96] = -73.5984120021699;
    			data_y[1][97] = -75.1986791750297;
    			data_y[1][98] = -76.7989013953919;
    			data_y[1][99] = -78.3990862272337;
    			data_y[1][100] = -79.9992399615847;
    						// 作図
    			Bode gp = new Bode(title, g_title, x_scale, 2, y_scale, 0, data_x, data_y, true, true);
    		}
    	}
    
    	/************/
    	/* 終了処理 */
    	/************/
    	class WinEnd extends WindowAdapter
    	{
    		public void windowClosing(WindowEvent e) {
    			System.exit(0);
    		}
    	}
    }
    
    /****************************/
    /* 棒グラフの描画           */
    /*      coded by Y.Suganuma */
    /****************************/
    class BarGraph extends Frame {
    
    	String title[];   // グラフのタイトル
    	String g_title[];   // 凡例(グラフの内容)
    	String x_title[];   // x軸への表示
    	double y_scale[];   // y軸目盛り
    	double data[][];   // データ
    	boolean d_t;   // タイトル表示の有無
    	boolean d_g;   // 凡例表示の有無
    	boolean ver = true;   // 縦か横か
    	int place;   // 小数点以下の桁数
    	int width = 900, height = 600;   // Windowの大きさ(初期サイズ)
    	int bx1, bx2, by1, by2;   // 表示切り替えボタンの位置
    	String change = "横 色";   // 表示切り替えボタン
    	Color cl[] = {Color.black, Color.magenta, Color.blue, Color.orange, Color.cyan,
    	              Color.pink, Color.green, Color.yellow, Color.darkGray, Color.red};   // グラフの色
    	int n_g;   // グラフの数
    
    	/*****************************************************/
    	/* コンストラクタ                                    */
    	/*      title_i : グラフ,x軸,及び,y軸のタイトル */
    	/*      g_title_i : 凡例                             */
    	/*      x_title_i : 横軸の表示項目                   */
    	/*      y_scale_i : データの最小値,最大値,目盛幅   */
    	/*      place_i : 小数点以下の桁数                   */
    	/*      data_i : グラフのデータ                      */
    	/*      d_t_i : タイトル表示の有無                   */
    	/*      d_g_i : 凡例表示の有無                       */
    	/*****************************************************/
    	BarGraph(String title_i[], String g_title_i[], String x_title_i[],
                 double y_scale_i[], int place_i, double data_i[][],
                 boolean d_t_i, boolean d_g_i)
    	{
    					// Frameクラスのコンストラクタの呼び出し
    		super("棒グラフ");
    					// テーブルデータの保存
    		title   = title_i;
    		g_title = g_title_i;
    		x_title = x_title_i;
    		y_scale = y_scale_i;
    		place   = place_i;
    		data    = data_i;
    		d_t     = d_t_i;
    		d_g     = d_g_i;
    					// Windowサイズと表示位置を設定
    		setSize(width, height);
    		Toolkit tool = getToolkit();
    		Dimension d  = tool.getScreenSize();
    		setLocation(d.width / 2 - width / 2, d.height / 2 - height / 2);
    					// ウィンドウを表示
    		setVisible(true);
    					// イベントアダプタ
    		addWindowListener(new WinEnd());
    		addComponentListener(new ComponentResize());
    		addMouseListener(new ClickMouse(this));
    	}
    
    	/********/
    	/* 描画 */
    	/********/
    	public void paint (Graphics g)
    	{
    		double r, x1, y1, sp;
    		int i1, i2, k, k1, k2, kx, ky, han, len;
    		int x_l, x_r, y_u, y_d;   // 描画領域
    		int f_size;   // フォントサイズ
    		int n_p;   // データの数
    		int g_w;   // グラフの幅
    		String s1;
    		Font f;
    		FontMetrics fm;
    		Graphics2D g2 = (Graphics2D)g;
    					//
    					// Windowサイズの取得
    					//
    		Insets insets = getInsets();
    		Dimension d = getSize();
    		width  = d.width - (insets.left + insets.right);
    		height = d.height - (insets.top + insets.bottom);
    		x_l    = insets.left + 10;
    		x_r    = d.width - insets.right - 10;
    		y_u    = insets.top + 20;
    		y_d    = d.height - insets.bottom;
    					//
    					// グラフタイトルの表示
    					//
    		r      = 0.05;   // タイトル領域の割合
    		f_size = ((y_d - y_u) < (x_r - x_l)) ? (int)((y_d - y_u) * r) : (int)((x_r - x_l) * r);
    		if (f_size < 5)
    			f_size = 5;
    		if (d_t) {
    			f = new Font("TimesRoman", Font.BOLD, f_size);
    			g.setFont(f);
    			fm  = g.getFontMetrics(f);
    			len = fm.stringWidth(title[0]);
    			g.drawString(title[0], (x_l+x_r)/2-len/2, y_d-f_size/2);
    			y_d -= f_size;
    		}
    					//
    					// 表示切り替えボタンの設置
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f  = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm = g.getFontMetrics(f);
    		g.setFont(f);
    		g.setColor(Color.yellow);
    		len = fm.stringWidth(change);
    		bx1 = x_r - len - 7 * f_size / 10;
    		by1 = y_u - f_size / 2;
    		bx2 = bx1 + len + f_size / 2;
    		by2 = by1 + 6 * f_size / 5;
    		g.fill3DRect(bx1, by1, len+f_size/2, 6*f_size/5, true);
    		g.setColor(Color.black);
    		g.drawString(change, x_r-len-f_size/2, y_u+f_size/2);
    					//
    					// 凡例の表示
    					//
    		n_g = g_title.length;
    		if (d_g) {
    			han = 0;
    			for (i1 = 0; i1 < n_g; i1++) {
    				len = fm.stringWidth(g_title[i1]);
    				if (len > han)
    					han = len;
    			}
    			han += 15;
    			r    = 0.2;   // 凡例領域の割合
    			k1   = (int)((x_r - x_l) * r);
    			if (han > k1)
    				han = k1;
    			kx = x_r - han;
    			ky = y_u + 3 * f_size / 2;
    			k  = 0;
    			g2.setStroke(new BasicStroke(7.0f));
    			for (i1 = 0; i1 < n_g; i1++) {
    				g.setColor(cl[k]);
    				g.drawLine(kx, ky, kx+10, ky);
    				g.setColor(Color.black);
    				g.drawString(g_title[i1], kx+15, ky+2*f_size/5);
    				k++;
    				if (k >= cl.length)
    					k = 0;
    				ky += f_size;
    			}
    			g2.setStroke(new BasicStroke(1.0f));
    			x_r -= (han + 10);
    		}
    		else
    			x_r -= (int)(0.03 * (x_r - x_l));
    					//
    					// x軸及びy軸のタイトルの表示
    					//
    		if (ver) {   // 縦
    			if (title[1].length() > 0 && !title[1].equals("-")) {
    				len = fm.stringWidth(title[1]);
    				g.drawString(title[1], (x_l+x_r)/2-len/2, y_d-4*f_size/5);
    				y_d -= 7 * f_size / 4;
    			}
    			else
    				y_d -= f_size / 2;
    			if (title[2].length() > 0 && !title[2].equals("-")) {
    				g.drawString(title[2], x_l, y_u+f_size/2);
    				y_u += f_size;
    			}
    		}
    		else {   // 横
    			if (title[2].length() > 0 && !title[2].equals("-")) {
    				len = fm.stringWidth(title[2]);
    				g.drawString(title[2], (x_l+x_r)/2-len/2, y_d-4*f_size/5);
    				y_d -= 7 * f_size / 4;
    			}
    			else
    				y_d -= f_size / 2;
    			if (title[1].length() > 0 && !title[1].equals("-")) {
    				g.drawString(title[1], x_l, y_u+f_size/2);
    				y_u += f_size;
    			}
    		}
    					//
    					// x軸,y軸,及び,各軸の目盛り
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f    = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm   = g.getFontMetrics(f);
    		y_d -= 3 * f_size / 2;
    		k    = (int)((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		n_p  = x_title.length;
    		g.setFont(f);
    
    		DecimalFormat df;
    		if (place == 0)
    			df = new DecimalFormat("#");
    		else {
    			s1 = "#.";
    			for (i1 = 0; i1 < place; i1++)
    				s1 += "0";
    			df = new DecimalFormat(s1);
    		}
    						// 縦表示
    		if (ver) {
    							// y軸
    			y1  = y_scale[0];
    			len = 0;
    			for (i1 = 0; i1 < k+1; i1++) {
    				s1 = df.format(y1);
    				k1 = fm.stringWidth(s1);
    				if (k1 > len)
    					len = k1;
    				y1 += y_scale[2];
    			}
    			g.drawLine(x_l+len+5, y_u, x_l+len+5, y_d);
    			g.drawLine(x_r, y_u, x_r, y_d);
    			y1 = y_scale[0];
    			x1 = y_d;
    			sp = (double)(y_d - y_u) / k;
    			for (i1 = 0; i1 < k+1; i1++) {
    				ky = (int)Math.round(x1);
    				s1 = df.format(y1);
    				k1 = fm.stringWidth(s1);
    				g.drawString(s1, x_l+len-k1, ky+f_size/2);
    				g.drawLine(x_l+len+5, ky, x_r, ky);
    				y1 += y_scale[2];
    				x1 -= sp;
    			}
    			x_l += (len + 5);
    							// x軸
    			sp  = (double)(x_r - x_l) / n_p;
    			x1  = x_l + sp / 2.0;
    			for (i1 = 0; i1 < n_p; i1++) {
    				kx  = (int)Math.round(x1);
    				k1 = fm.stringWidth(x_title[i1]);
    				g.drawString(x_title[i1], kx-k1/2, y_d+6*f_size/5);
    				g.drawLine(kx, y_d, kx, y_d-5);
    				x1 += sp;
    			}
    		}
    						// 横表示
    		else {
    							// y軸
    			len = 0;
    			for (i1 = 0; i1 < n_p; i1++) {
    				k1 = fm.stringWidth(x_title[i1]);
    				if (k1 > len)
    					len = k1;
    			}
    			g.drawLine(x_l+len+5, y_u, x_l+len+5, y_d);
    			g.drawLine(x_r, y_u, x_r, y_d);
    			sp = (double)(y_d - y_u) / n_p;
    			y1 = y_d - sp / 2.0;
    			for (i1 = 0; i1 < n_p; i1++) {
    				ky = (int)Math.round(y1);
    				k1 = fm.stringWidth(x_title[n_p-1-i1]);
    				g.drawString(x_title[n_p-1-i1], x_l+len-k1, ky+f_size/2);
    				g.drawLine(x_l+len+5, ky, x_l+len+10, ky);
    				y1 -= sp;
    			}
    			g.drawLine(x_l+len+5, y_u, x_r, y_u);
    			g.drawLine(x_l+len+5, y_d, x_r, y_d);
    			x_l += (len + 5);
    							// x軸
    			x1 = y_scale[0];
    			y1 = x_l;
    			sp = (double)(x_r - x_l) / k;
    			for (i1 = 0; i1 < k+1; i1++) {
    				kx = (int)Math.round(y1);
    				s1 = df.format(x1);
    				k1 = fm.stringWidth(s1);
    				g.drawString(s1, kx-k1/2, y_d+6*f_size/5);
    				g.drawLine(kx, y_d, kx, y_u);
    				x1 += y_scale[2];
    				y1 += sp;
    			}
    		}
    					//
    					// グラフの表示
    					//
    						// 縦表示
    		if (ver) {
    			g_w = (int)(0.8 * (x_r - x_l) / (n_g * n_p));
    			sp  = (double)(x_r - x_l) / n_p;
    			x1  = x_l + sp / 2.0;
    			for (i1 = 0; i1 < n_p; i1++) {
    				kx  = (int)Math.round(x1);
    				k1 = 0;
    				k2 = kx - n_g * g_w / 2;
    				for (i2 = 0; i2 < n_g; i2++) {
    					ky = y_d - (int)((y_d - y_u) * (data[i2][i1] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    					g.setColor(cl[k1]);
    					g.fillRect(k2, ky, g_w, y_d-ky);
    					k2 += g_w;
    					k1++;
    					if (k1 >= cl.length)
    						k1 = 0;
    				}
    				x1 += sp;
    			}
    		}
    						// 横表示
    		else {
    			g_w = (int)(0.8 * (y_d - y_u) / (n_g * n_p));
    			sp  = (double)(y_d - y_u) / n_p;
    			y1  = y_d - sp / 2.0;
    			for (i1 = 0; i1 < n_p; i1++) {
    				ky = (int)Math.round(y1);
    				k1 = 0;
    				k2 = ky - n_g * g_w / 2;
    				for (i2 = 0; i2 < n_g; i2++) {
    					kx = (int)((x_r - x_l) * (data[i2][n_p-1-i1] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    					g.setColor(cl[k1]);
    					g.fillRect(x_l, k2, kx, g_w);
    					k2 += g_w;
    					k1++;
    					if (k1 >= cl.length)
    						k1 = 0;
    				}
    				y1 -= sp;
    			}
    		}
    	}
    
    	/************************************/
    	/* マウスがクリックされたときの処理 */
    	/************************************/
    	class ClickMouse extends MouseAdapter
    	{
    		BarGraph db;
    
    		ClickMouse(BarGraph db1)
    		{
    			db = db1;
    		}
    
    		public void mouseClicked(MouseEvent e)
    		{
    			int xp = e.getX();
    			int yp = e.getY();
    					// 縦表示と横表示の変換
    			if (xp > bx1 && xp < bx1+(bx2-bx1)/2 && yp > by1 && yp < by2) {
    				if (ver) {
    					ver    = false;
    					change = "縦 色";
    				}
    				else {
    					ver    = true;
    					change = "横 色";
    				}
    				repaint();
    			}
    					// グラフの色,線の太さ等
    			else if (xp > bx1+(bx2-bx1)/2 && xp < bx2 && yp > by1 && yp < by2) {
    				Modify md = new Modify(db);
    				md.setVisible(true);
    			}
    		}
    	}
    
    	/**********************/
    	/* Windowのサイズ変化 */
    	/**********************/
    	class ComponentResize extends ComponentAdapter
    	{
    		public void componentResized(ComponentEvent e)
    		{
    			repaint();
    		}
    	}
    
    	/************/
    	/* 終了処理 */
    	/************/
    	class WinEnd extends WindowAdapter
    	{
    		public void windowClosing(WindowEvent e) {
    			setVisible(false);
    		}
    	}
    }
    
    /****************************/
    /* 折れ線グラフの描画       */
    /*      coded by Y.Suganuma */
    /****************************/
    class LineGraph extends Frame {
    
    	String title[];   // グラフのタイトル
    	String g_title[];   // 凡例(グラフの内容)
    	String x_title[];   // x軸への表示
    	double x_scale[];   // y軸目盛り
    	double y_scale[];   // y軸目盛り
    	double data_x[][], data_y[][];   // データ
    	boolean d_t;   // タイトル表示の有無
    	boolean d_g;   // 凡例表示の有無
    	boolean type = true;   // 横軸が項目かデータか
    	boolean ver = true;   // 縦か横か
    	int place_x;   // 小数点以下の桁数(x軸)
    	int place_y;   // 小数点以下の桁数(y軸)
    	int width = 900, height = 600;   // Windowの大きさ(初期サイズ)
    	int bx1, bx2, by1, by2;   // 表示切り替えボタンの位置
    	String change = "横 色";   // 表示切り替えボタン
    	float line_w = 1.0f;   // 折れ線グラフ等の線の太さ
    	boolean line_m = true;   // 折れ線グラフ等にマークを付けるか否か
    	Color cl[] = {Color.black, Color.magenta, Color.blue, Color.orange, Color.cyan,
    	              Color.pink, Color.green, Color.yellow, Color.darkGray, Color.red};   // グラフの色
    	int n_g;   // グラフの数
    
    	/*****************************************************/
    	/* コンストラクタ(折れ線グラフ1)                  */
    	/*      title_i : グラフ,x軸,及び,y軸のタイトル */
    	/*      g_title_i : 凡例                             */
    	/*      x_title_i : 横軸の表示項目                   */
    	/*      y_scale_i : データの最小値,最大値,目盛幅   */
    	/*      place_y_i : 小数点以下の桁数(y軸)         */
    	/*      data_y_i : グラフのデータ                    */
    	/*      d_t_i : タイトル表示の有無                   */
    	/*      d_g_i : 凡例表示の有無                       */
    	/*****************************************************/
    	LineGraph(String title_i[], String g_title_i[], String x_title_i[],
                  double y_scale_i[], int place_y_i, double data_y_i[][],
                  boolean d_t_i, boolean d_g_i)
    	{
    					// Frameクラスのコンストラクタの呼び出し
    		super("折れ線グラフ(1)");
    					// テーブルデータの保存
    		title   = title_i;
    		g_title = g_title_i;
    		x_title = x_title_i;
    		y_scale = y_scale_i;
    		place_y = place_y_i;
    		data_y  = data_y_i;
    		d_t     = d_t_i;
    		d_g     = d_g_i;
    					// Windowサイズと表示位置を設定
    		setSize(width, height);
    		Toolkit tool = getToolkit();
    		Dimension d  = tool.getScreenSize();
    		setLocation(d.width / 2 - width / 2, d.height / 2 - height / 2);
    					// ウィンドウを表示
    		setVisible(true);
    					// イベントアダプタ
    		addWindowListener(new WinEnd());
    		addComponentListener(new ComponentResize());
    		addMouseListener(new ClickMouse(this));
    	}
    
    	/*********************************************************/
    	/* コンストラクタ(折れ線グラフ2)                      */
    	/*      title_i : グラフ,x軸,及び,y軸のタイトル     */
    	/*      g_title_i : 凡例                                 */
    	/*      x_scale_i : データの最小値,最大値,目盛幅(y) */
    	/*      place_x_i : 小数点以下の桁数(x軸)             */
    	/*      y_scale_i : データの最小値,最大値,目盛幅(y) */
    	/*      place_y_i : 小数点以下の桁数(y軸)             */
    	/*      data_x_i : グラフのデータ(x軸)                */
    	/*      data_y_i : グラフのデータ(y軸)                */
    	/*      d_t_i : タイトル表示の有無                       */
    	/*      d_g_i : 凡例表示の有無                           */
    	/*********************************************************/
    	LineGraph(String title_i[], String g_title_i[], double x_scale_i[],
                  int place_x_i, double y_scale_i[], int place_y_i,
                  double data_x_i[][], double data_y_i[][], boolean d_t_i,
                  boolean d_g_i)
    	{
    					// Frameクラスのコンストラクタの呼び出し
    		super("折れ線グラフ(2)");
    					// テーブルデータの保存
    		title   = title_i;
    		g_title = g_title_i;
    		x_scale = x_scale_i;
    		place_x = place_x_i;
    		y_scale = y_scale_i;
    		place_y = place_y_i;
    		data_x  = data_x_i;
    		data_y  = data_y_i;
    		d_t     = d_t_i;
    		d_g     = d_g_i;
    		type    = false;
    					// Windowサイズと表示位置を設定
    		setSize(width, height);
    		Toolkit tool = getToolkit();
    		Dimension d  = tool.getScreenSize();
    		setLocation(d.width / 2 - width / 2, d.height / 2 - height / 2);
    					// ウィンドウを表示
    		setVisible(true);
    					// イベントアダプタ
    		addWindowListener(new WinEnd());
    		addComponentListener(new ComponentResize());
    		addMouseListener(new ClickMouse(this));
    	}
    
    	/********/
    	/* 描画 */
    	/********/
    	public void paint (Graphics g)
    	{
    		double r, x1, y1, sp;
    		int i1, i2, cr, k, k_x, k_y, k1, k2, kx, kx1, ky, ky1, han, len;
    		int x_l, x_r, y_u, y_d;   // 描画領域
    		int f_size;   // フォントサイズ
    		int n_p;   // データの数
    		String s1;
    		Font f;
    		FontMetrics fm;
    		Graphics2D g2 = (Graphics2D)g;
    					//
    					// Windowサイズの取得
    					//
    		Insets insets = getInsets();
    		Dimension d = getSize();
    		width  = d.width - (insets.left + insets.right);
    		height = d.height - (insets.top + insets.bottom);
    		x_l    = insets.left + 10;
    		x_r    = d.width - insets.right - 10;
    		y_u    = insets.top + 20;
    		y_d    = d.height - insets.bottom;
    					//
    					// グラフタイトルの表示
    					//
    		r      = 0.05;   // タイトル領域の割合
    		f_size = ((y_d - y_u) < (x_r - x_l)) ? (int)((y_d - y_u) * r) : (int)((x_r - x_l) * r);
    		if (f_size < 5)
    			f_size = 5;
    		if (d_t) {
    			f = new Font("TimesRoman", Font.BOLD, f_size);
    			g.setFont(f);
    			fm  = g.getFontMetrics(f);
    			len = fm.stringWidth(title[0]);
    			g.drawString(title[0], (x_l+x_r)/2-len/2, y_d-f_size/2);
    			y_d -= f_size;
    		}
    					//
    					// 表示切り替えボタンの設置
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f  = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm = g.getFontMetrics(f);
    		g.setFont(f);
    		g.setColor(Color.yellow);
    		len = fm.stringWidth(change);
    		bx1 = x_r - len - 7 * f_size / 10;
    		by1 = y_u - f_size / 2;
    		bx2 = bx1 + len + f_size / 2;
    		by2 = by1 + 6 * f_size / 5;
    		g.fill3DRect(bx1, by1, len+f_size/2, 6*f_size/5, true);
    		g.setColor(Color.black);
    		g.drawString(change, x_r-len-f_size/2, y_u+f_size/2);
    					//
    					// 凡例の表示
    					//
    		n_g = g_title.length;
    		if (d_g) {
    			han = 0;
    			for (i1 = 0; i1 < n_g; i1++) {
    				len = fm.stringWidth(g_title[i1]);
    				if (len > han)
    					han = len;
    			}
    			han += 15;
    			r    = 0.2;   // 凡例領域の割合
    			k1   = (int)((x_r - x_l) * r);
    			if (han > k1)
    				han = k1;
    			kx = x_r - han;
    			ky = y_u + 3 * f_size / 2;
    			k  = 0;
    			g2.setStroke(new BasicStroke(7.0f));
    			for (i1 = 0; i1 < n_g; i1++) {
    				g.setColor(cl[k]);
    				g.drawLine(kx, ky, kx+10, ky);
    				g.setColor(Color.black);
    				g.drawString(g_title[i1], kx+15, ky+2*f_size/5);
    				k++;
    				if (k >= cl.length)
    					k = 0;
    				ky += f_size;
    			}
    			g2.setStroke(new BasicStroke(1.0f));
    			x_r -= (han + 10);
    		}
    		else
    			x_r -= (int)(0.03 * (x_r - x_l));
    					//
    					// x軸及びy軸のタイトルの表示
    					//
    		if (ver) {   // 縦
    			if (title[1].length() > 0 && !title[1].equals("-")) {
    				len = fm.stringWidth(title[1]);
    				g.drawString(title[1], (x_l+x_r)/2-len/2, y_d-4*f_size/5);
    				y_d -= 7 * f_size / 4;
    			}
    			else
    				y_d -= f_size / 2;
    			if (title[2].length() > 0 && !title[2].equals("-")) {
    				g.drawString(title[2], x_l, y_u+f_size/2);
    				y_u += f_size;
    			}
    		}
    		else {   // 横
    			if (title[2].length() > 0 && !title[2].equals("-")) {
    				len = fm.stringWidth(title[2]);
    				g.drawString(title[2], (x_l+x_r)/2-len/2, y_d-4*f_size/5);
    				y_d -= 7 * f_size / 4;
    			}
    			else
    				y_d -= f_size / 2;
    			if (title[1].length() > 0 && !title[1].equals("-")) {
    				g.drawString(title[1], x_l, y_u+f_size/2);
    				y_u += f_size;
    			}
    		}
    					//
    					// x軸,y軸,及び,各軸の目盛り
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f    = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm   = g.getFontMetrics(f);
    		y_d -= 3 * f_size / 2;
    		k_y  = (int)((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		k_x  = 0;
    		if (!type)
    			k_x = (int)((x_scale[1] - x_scale[0]) / (0.99 * x_scale[2]));
    		g.setFont(f);
    
    		DecimalFormat df_x, df_y;
    		df_x = new DecimalFormat("#");
    		df_y = new DecimalFormat("#");
    		if (!type) {
    			if (place_x != 0) {
    				s1 = "#.";
    				for (i1 = 0; i1 < place_x; i1++)
    					s1 += "0";
    				df_x = new DecimalFormat(s1);
    			}
    		}
    		if (place_y != 0) {
    			s1 = "#.";
    			for (i1 = 0; i1 < place_y; i1++)
    				s1 += "0";
    			df_y = new DecimalFormat(s1);
    		}
    						// 縦表示
    		if (ver) {
    							// y軸
    			y1  = y_scale[0];
    			len = 0;
    			for (i1 = 0; i1 < k_y+1; i1++) {
    				s1 = df_y.format(y1);
    				k1 = fm.stringWidth(s1);
    				if (k1 > len)
    					len = k1;
    				y1 += y_scale[2];
    			}
    			g.drawLine(x_l+len+5, y_u, x_l+len+5, y_d);
    			g.drawLine(x_r, y_u, x_r, y_d);
    			y1 = y_scale[0];
    			x1 = y_d;
    			sp = (double)(y_d - y_u) / k_y;
    			for (i1 = 0; i1 < k_y+1; i1++) {
    				ky = (int)Math.round(x1);
    				s1 = df_y.format(y1);
    				k1 = fm.stringWidth(s1);
    				g.drawString(s1, x_l+len-k1, ky+f_size/2);
    				g.drawLine(x_l+len+5, ky, x_r, ky);
    				y1 += y_scale[2];
    				x1 -= sp;
    			}
    			x_l += (len + 5);
    							// x軸
    			if (type) {
    				n_p = x_title.length;
    				sp  = (double)(x_r - x_l) / n_p;
    				x1  = x_l + sp / 2.0;
    				for (i1 = 0; i1 < n_p; i1++) {
    					kx = (int)Math.round(x1);
    					k1 = fm.stringWidth(x_title[i1]);
    					g.drawString(x_title[i1], kx-k1/2, y_d+6*f_size/5);
    					g.drawLine(kx, y_d, kx, y_d-5);
    					x1 += sp;
    				}
    			}
    			else {
    				x1 = x_scale[0];
    				y1 = x_l;
    				sp = (double)(x_r - x_l) / k_x;
    				for (i1 = 0; i1 < k_x+1; i1++) {
    					kx = (int)Math.round(y1);
    					s1 = df_x.format(x1);
    					k1 = fm.stringWidth(s1);
    					g.drawString(s1, kx-k1/2, y_d+6*f_size/5);
    					g.drawLine(kx, y_d, kx, y_u);
    					x1 += x_scale[2];
    					y1 += sp;
    				}
    			}
    		}
    						// 横表示
    		else {
    							// y軸
    			if (type) {
    				n_p = x_title.length;
    				len = 0;
    				for (i1 = 0; i1 < n_p; i1++) {
    					k1 = fm.stringWidth(x_title[i1]);
    					if (k1 > len)
    						len = k1;
    				}
    				g.drawLine(x_l+len+5, y_u, x_l+len+5, y_d);
    				g.drawLine(x_r, y_u, x_r, y_d);
    				sp = (double)(y_d - y_u) / n_p;
    				x1 = y_d - sp / 2.0;
    				for (i1 = 0; i1 < n_p; i1++) {
    					ky = (int)Math.round(x1);
    					k1 = fm.stringWidth(x_title[n_p-1-i1]);
    					g.drawString(x_title[n_p-1-i1], x_l+len-k1, ky+f_size/2);
    					g.drawLine(x_l+len+5, ky, x_l+len+10, ky);
    					x1 -= sp;
    				}
    				g.drawLine(x_l+len+5, y_u, x_r, y_u);
    				g.drawLine(x_l+len+5, y_d, x_r, y_d);
    				x_l += (len + 5);
    			}
    			else {
    				y1  = x_scale[0];
    				len = 0;
    				for (i1 = 0; i1 < k_x+1; i1++) {
    					s1 = df_x.format(y1);
    					k1 = fm.stringWidth(s1);
    					if (k1 > len)
    						len = k1;
    					y1 += x_scale[2];
    				}
    				g.drawLine(x_l+len+5, y_u, x_l+len+5, y_d);
    				g.drawLine(x_r, y_u, x_r, y_d);
    				y1 = x_scale[0];
    				x1 = y_d;
    				sp = (double)(y_d - y_u) / k_x;
    				for (i1 = 0; i1 < k_x+1; i1++) {
    					ky = (int)Math.round(x1);
    					s1 = df_x.format(y1);
    					k1 = fm.stringWidth(s1);
    					g.drawString(s1, x_l+len-k1, ky+f_size/2);
    					g.drawLine(x_l+len+5, ky, x_r, ky);
    					y1 += x_scale[2];
    					x1 -= sp;
    				}
    				x_l += (len + 5);
    			}
    							// x軸
    			x1 = y_scale[0];
    			y1 = x_l;
    			sp = (double)(x_r - x_l) / k_y;
    			for (i1 = 0; i1 < k_y+1; i1++) {
    				kx = (int)Math.round(y1);
    				s1 = df_y.format(x1);
    				k1 = fm.stringWidth(s1);
    				g.drawString(s1, kx-k1/2, y_d+6*f_size/5);
    				g.drawLine(kx, y_d, kx, y_u);
    				x1 += y_scale[2];
    				y1 += sp;
    			}
    		}
    					//
    					// グラフの表示
    					//
    		g2.setStroke(new BasicStroke(line_w));
    		cr = (int)line_w + 6;
    						// 縦表示
    		if (ver) {
    			if (type) {
    				n_p = x_title.length;
    				sp  = (double)(x_r - x_l) / n_p;
    				k1  = 0;
    				for (i1 = 0; i1 < n_g; i1++) {
    					g.setColor(cl[k1]);
    					x1  = x_l + sp / 2.0;
    					kx1 = 0;
    					ky1 = 0;
    					for (i2 = 0; i2 < n_p; i2++) {
    						kx = (int)Math.round(x1);
    						ky = y_d - (int)((y_d - y_u) * (data_y[i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    						if (line_m)
    							g.fillOval(kx-cr/2, ky-cr/2, cr, cr);
    						if (i2 > 0)
    							g.drawLine(kx1, ky1, kx, ky);
    						kx1  = kx;
    						ky1  = ky;
    						x1  += sp;
    					}
    					k1++;
    					if (k1 >= cl.length)
    						k1 = 0;
    				}
    			}
    			else {
    				n_p = data_x[0].length;
    				k1  = 0;
    				for (i1 = 0; i1 < n_g; i1++) {
    					g.setColor(cl[k1]);
    					kx1 = 0;
    					ky1 = 0;
    					for (i2 = 0; i2 < n_p; i2++) {
    						kx = x_l + (int)((x_r - x_l) * (data_x[i1][i2] - x_scale[0]) / (x_scale[1] - x_scale[0]));
    						ky = y_d - (int)((y_d - y_u) * (data_y[i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    						if (line_m)
    							g.fillOval(kx-cr/2, ky-cr/2, cr, cr);
    						if (i2 > 0)
    							g.drawLine(kx1, ky1, kx, ky);
    						kx1 = kx;
    						ky1 = ky;
    					}
    					k1++;
    					if (k1 >= cl.length)
    						k1 = 0;
    				}
    			}
    		}
    						// 横表示
    		else {
    			if (type) {
    				n_p = x_title.length;
    				sp = (double)(y_d - y_u) / n_p;
    				k1 = 0;
    				for (i1 = 0; i1 < n_g; i1++) {
    					g.setColor(cl[k1]);
    					y1  = y_d - sp / 2.0;
    					kx1 = 0;
    					ky1 = 0;
    					for (i2 = 0; i2 < n_p; i2++) {
    						ky = (int)Math.round(y1);
    						kx = x_l + (int)((x_r - x_l) * (data_y[i1][n_p-1-i2] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    						if (line_m)
    							g.fillOval(kx-cr/2, ky-cr/2, cr, cr);
    						if (i2 > 0)
    							g.drawLine(kx1, ky1, kx, ky);
    						kx1  = kx;
    						ky1  = ky;
    						y1  -= sp;
    					}
    					k1++;
    					if (k1 >= cl.length)
    						k1 = 0;
    				}
    			}
    			else {
    				n_p = data_x[0].length;
    				k1  = 0;
    				for (i1 = 0; i1 < n_g; i1++) {
    					g.setColor(cl[k1]);
    					kx1 = 0;
    					ky1 = 0;
    					for (i2 = 0; i2 < n_p; i2++) {
    						kx = x_l + (int)((x_r - x_l) * (data_y[i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    						ky = y_d - (int)((y_d - y_u) * (data_x[i1][i2] - x_scale[0]) / (x_scale[1] - x_scale[0]));
    						if (line_m)
    							g.fillOval(kx-cr/2, ky-cr/2, cr, cr);
    						if (i2 > 0)
    							g.drawLine(kx1, ky1, kx, ky);
    						kx1 = kx;
    						ky1 = ky;
    					}
    					k1++;
    					if (k1 >= cl.length)
    						k1 = 0;
    				}
    			}
    		}
    	}
    
    	/************************************/
    	/* マウスがクリックされたときの処理 */
    	/************************************/
    	class ClickMouse extends MouseAdapter
    	{
    		LineGraph dr;
    
    		ClickMouse(LineGraph dr1)
    		{
    			dr = dr1;
    		}
    
    		public void mouseClicked(MouseEvent e)
    		{
    			int xp = e.getX();
    			int yp = e.getY();
    					// 縦表示と横表示の変換
    			if (xp > bx1 && xp < bx1+(bx2-bx1)/2 && yp > by1 && yp < by2) {
    				if (ver) {
    					ver    = false;
    					change = "縦 色";
    				}
    				else {
    					ver    = true;
    					change = "横 色";
    				}
    				repaint();
    			}
    					// グラフの色,線の太さ等
    			else if (xp > bx1+(bx2-bx1)/2 && xp < bx2 && yp > by1 && yp < by2) {
    				Modify md = new Modify(dr);
    				md.setVisible(true);
    			}
    		}
    	}
    
    	/**********************/
    	/* Windowのサイズ変化 */
    	/**********************/
    	class ComponentResize extends ComponentAdapter
    	{
    		public void componentResized(ComponentEvent e)
    		{
    			repaint();
    		}
    	}
    
    	/************/
    	/* 終了処理 */
    	/************/
    	class WinEnd extends WindowAdapter
    	{
    		public void windowClosing(WindowEvent e) {
    			setVisible(false);
    		}
    	}
    }
    
    /****************************/
    /* 積み上げ棒グラフの描画   */
    /*      coded by Y.Suganuma */
    /****************************/
    class StackGraph extends Frame {
    
    	String title[];   // グラフのタイトル
    	String g_title[];   // グラフの内容
    	String item[];   // 凡例
    	double y_scale[];   // y軸目盛り
    	double data[][];   // データ
    	boolean d_t;   // タイトル表示の有無
    	boolean ver = true;   // 縦か横か
    	int place;   // 小数点以下の桁数
    	int width = 900, height = 600;   // Windowの大きさ(初期サイズ)
    	int bx1, bx2, by1, by2;   // 表示切り替えボタンの位置
    	String change = "横 色";   // 表示切り替えボタン
    	Color cl[] = {Color.black, Color.magenta, Color.blue, Color.orange, Color.cyan,
    	              Color.pink, Color.green, Color.yellow, Color.darkGray, Color.red};   // グラフの色
    	int n_p;   // データの数
    
    	/*****************************************************/
    	/* コンストラクタ                                    */
    	/*      title_i : グラフ,x軸,及び,y軸のタイトル */
    	/*      g_title_i : グラフの内容                     */
    	/*      item_i : 凡例                                */
    	/*      y_scale_i : データの最小値,最大値,目盛幅   */
    	/*      place_i : 小数点以下の桁数                   */
    	/*      data_i : グラフのデータ                      */
    	/*      d_t_i : タイトル表示の有無                   */
    	/*****************************************************/
    	StackGraph(String title_i[], String g_title_i[], String item_i[],
                   double y_scale_i[], int place_i, double data_i[][],
                   boolean d_t_i)
    	{
    					// Frameクラスのコンストラクタの呼び出し
    		super("積み上げ棒グラフ");
    					// テーブルデータの保存
    		title   = title_i;
    		g_title = g_title_i;
    		item    = item_i;
    		y_scale = y_scale_i;
    		place   = place_i;
    		data    = data_i;
    		d_t     = d_t_i;
    					// Windowサイズと表示位置を設定
    		setSize(width, height);
    		Toolkit tool = getToolkit();
    		Dimension d  = tool.getScreenSize();
    		setLocation(d.width / 2 - width / 2, d.height / 2 - height / 2);
    					// ウィンドウを表示
    		setVisible(true);
    					// イベントアダプタ
    		addWindowListener(new WinEnd());
    		addComponentListener(new ComponentResize());
    		addMouseListener(new ClickMouse(this));
    	}
    
    	/********/
    	/* 描画 */
    	/********/
    	public void paint (Graphics g)
    	{
    		double r, x1, y1, y2, sp;
    		int i1, i2, k, k1, k2, kx, ky, han, len;
    		int x_l, x_r, y_u, y_d;   // 描画領域
    		int f_size;   // フォントサイズ
    		int n_g;   // グラフの数
    		int g_w;   // グラフの幅
    		String s1;
    		Font f;
    		FontMetrics fm;
    					//
    					// Windowサイズの取得
    					//
    		Insets insets = getInsets();
    		Dimension d = getSize();
    		width  = d.width - (insets.left + insets.right);
    		height = d.height - (insets.top + insets.bottom);
    		x_l    = insets.left + 10;
    		x_r    = d.width - insets.right - 10;
    		y_u    = insets.top + 20;
    		y_d    = d.height - insets.bottom;
    					//
    					// グラフタイトルの表示
    					//
    		r      = 0.05;   // タイトル領域の割合
    		f_size = ((y_d - y_u) < (x_r - x_l)) ? (int)((y_d - y_u) * r) : (int)((x_r - x_l) * r);
    		if (f_size < 5)
    			f_size = 5;
    		if (d_t) {
    			f = new Font("TimesRoman", Font.BOLD, f_size);
    			g.setFont(f);
    			fm  = g.getFontMetrics(f);
    			len = fm.stringWidth(title[0]);
    			g.drawString(title[0], (x_l+x_r)/2-len/2, y_d-f_size/2);
    			y_d -= 3 * f_size / 2;
    		}
    					//
    					// 表示切り替えボタンの設置
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f  = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm = g.getFontMetrics(f);
    		g.setFont(f);
    		g.setColor(Color.yellow);
    		len = fm.stringWidth(change);
    		bx1 = x_r - len - 7 * f_size / 10;
    		by1 = y_u - f_size / 2;
    		bx2 = bx1 + len + f_size / 2;
    		by2 = by1 + 6 * f_size / 5;
    		g.fill3DRect(bx1, by1, len+f_size/2, 6*f_size/5, true);
    		g.setColor(Color.black);
    		g.drawString(change, x_r-len-f_size/2, y_u+f_size/2);
    					//
    					// 凡例の表示
    					//
    		n_p = item.length;
    		han = 0;
    		for (i1 = 0; i1 < n_p; i1++) {
    			len = fm.stringWidth(item[i1]);
    			if (len > han)
    				han = len;
    		}
    		han += 15;
    		r    = 0.2;   // 凡例領域の割合
    		k1   = (int)((x_r - x_l) * r);
    		if (han > k1)
    			han = k1;
    		kx = x_r - han;
    		ky = y_u + 3 * f_size / 2;
    		k  = 0;
    		for (i1 = 0; i1 < n_p; i1++) {
    			g.setColor(cl[k]);
    			g.fillRect(kx, ky-3, 10, 6);
    			g.setColor(Color.black);
    			g.drawString(item[i1], kx+15, ky+2*f_size/5);
    			k++;
    			if (k >= cl.length)
    				k = 0;
    			ky += f_size;
    		}
    		x_r -= (han + 10);
    					//
    					// x軸及びy軸のタイトルの表示
    					//
    		if (ver) {   // 縦
    			if (title[1].length() > 0 && !title[1].equals("-")) {
    				len = fm.stringWidth(title[1]);
    				g.drawString(title[1], (x_l+x_r)/2-len/2, y_d-4*f_size/5);
    				y_d -= 7 * f_size / 4;
    			}
    			else
    				y_d -= f_size / 2;
    			if (title[2].length() > 0 && !title[2].equals("-")) {
    				g.drawString(title[2], x_l, y_u+f_size/2);
    				y_u += f_size;
    			}
    		}
    		else {   // 横
    			if (title[2].length() > 0 && !title[2].equals("-")) {
    				len = fm.stringWidth(title[2]);
    				g.drawString(title[2], (x_l+x_r)/2-len/2, y_d-4*f_size/5);
    				y_d -= 7 * f_size / 4;
    			}
    			else
    				y_d -= f_size / 2;
    			if (title[1].length() > 0 && !title[1].equals("-")) {
    				g.drawString(title[1], x_l, y_u+f_size/2);
    				y_u += f_size;
    			}
    		}
    					//
    					// x軸,y軸,及び,各軸の目盛り
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f    = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm   = g.getFontMetrics(f);
    		y_d -= 3 * f_size / 2;
    		k    = (int)((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		n_g  = g_title.length;
    		g.setFont(f);
    
    		DecimalFormat df;
    		if (place == 0)
    			df = new DecimalFormat("#");
    		else {
    			s1 = "#.";
    			for (i1 = 0; i1 < place; i1++)
    				s1 += "0";
    			df = new DecimalFormat(s1);
    		}
    						// 縦表示
    		if (ver) {
    							// y軸
    			y1  = y_scale[0];
    			len = 0;
    			for (i1 = 0; i1 < k+1; i1++) {
    				s1 = df.format(y1);
    				k1 = fm.stringWidth(s1);
    				if (k1 > len)
    					len = k1;
    				y1 += y_scale[2];
    			}
    			g.drawLine(x_l+len+5, y_u, x_l+len+5, y_d);
    			g.drawLine(x_r, y_u, x_r, y_d);
    			y1 = y_scale[0];
    			x1 = y_d;
    			sp = (double)(y_d - y_u) / k;
    			for (i1 = 0; i1 < k+1; i1++) {
    				ky = (int)Math.round(x1);
    				s1 = df.format(y1);
    				k1 = fm.stringWidth(s1);
    				g.drawString(s1, x_l+len-k1, ky+f_size/2);
    				g.drawLine(x_l+len+5, ky, x_r, ky);
    				y1 += y_scale[2];
    				x1 -= sp;
    			}
    			x_l += (len + 5);
    							// x軸
    			sp  = (double)(x_r - x_l) / n_g;
    			x1  = x_l + sp / 2.0;
    			for (i1 = 0; i1 < n_g; i1++) {
    				kx  = (int)Math.round(x1);
    				k1 = fm.stringWidth(g_title[i1]);
    				g.drawString(g_title[i1], kx-k1/2, y_d+6*f_size/5);
    				g.drawLine(kx, y_d, kx, y_d-5);
    				x1 += sp;
    			}
    		}
    						// 横表示
    		else {
    							// y軸
    			len = 0;
    			for (i1 = 0; i1 < n_g; i1++) {
    				k1 = fm.stringWidth(g_title[i1]);
    				if (k1 > len)
    					len = k1;
    			}
    			g.drawLine(x_l+len+5, y_u, x_l+len+5, y_d);
    			g.drawLine(x_r, y_u, x_r, y_d);
    			sp = (double)(y_d - y_u) / n_g;
    			y1 = y_d - sp / 2.0;
    			for (i1 = 0; i1 < n_g; i1++) {
    				ky = (int)Math.round(y1);
    				k1 = fm.stringWidth(g_title[n_g-1-i1]);
    				g.drawString(g_title[n_g-1-i1], x_l+len-k1, ky+f_size/2);
    				g.drawLine(x_l+len+5, ky, x_l+len+10, ky);
    				y1 -= sp;
    			}
    			g.drawLine(x_l+len+5, y_u, x_r, y_u);
    			g.drawLine(x_l+len+5, y_d, x_r, y_d);
    			x_l += (len + 5);
    							// x軸
    			x1 = y_scale[0];
    			y1 = x_l;
    			sp = (double)(x_r - x_l) / k;
    			for (i1 = 0; i1 < k+1; i1++) {
    				kx = (int)Math.round(y1);
    				s1 = df.format(x1);
    				k1 = fm.stringWidth(s1);
    				g.drawString(s1, kx-k1/2, y_d+6*f_size/5);
    				g.drawLine(kx, y_d, kx, y_u);
    				x1 += y_scale[2];
    				y1 += sp;
    			}
    		}
    					//
    					// グラフの表示
    					//
    						// 縦表示
    		if (ver) {
    			g_w = (int)(0.8 * (x_r - x_l) / n_g);
    			sp  = (double)(x_r - x_l) / n_g;
    			x1  = x_l + sp / 2.0;
    			for (i1 = 0; i1 < n_g; i1++) {
    				kx = (int)Math.round(x1);
    				k1 = 0;
    				y1 = y_d;
    				for (i2 = 0; i2 < n_p; i2++) {
    					ky = (int)Math.round(y1);
    					g.setColor(cl[k1]);
    					y2 = (y_d - y_u) * (data[i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]);
    					k2 = (int)Math.round(y2);
    					g.fillRect(kx-g_w/2, ky-k2, g_w, k2);
    					y1 -= y2;
    					k1++;
    					if (k1 >= cl.length)
    						k1 = 0;
    				}
    				x1 += sp;
    			}
    		}
    						// 横表示
    		else {
    			g_w = (int)(0.8 * (y_d - y_u) / n_g);
    			sp  = (double)(y_d - y_u) / n_g;
    			y1  = y_d - sp / 2.0;
    			for (i1 = 0; i1 < n_g; i1++) {
    				ky = (int)Math.round(y1);
    				k1 = 0;
    				x1 = x_l;
    				for (i2 = 0; i2 < n_p; i2++) {
    					kx = (int)Math.round(x1);
    					g.setColor(cl[k1]);
    					y2 = (x_r - x_l) * (data[n_g-1-i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]);
    					k2 = (int)Math.round(y2);
    					g.fillRect(kx, ky-g_w/2, k2, g_w);
    					x1 += y2;
    					k1++;
    					if (k1 >= cl.length)
    						k1 = 0;
    				}
    				y1 -= sp;
    			}
    		}
    	}
    
    	/************************************/
    	/* マウスがクリックされたときの処理 */
    	/************************************/
    	class ClickMouse extends MouseAdapter
    	{
    		StackGraph ds;
    
    		ClickMouse(StackGraph ds1)
    		{
    			ds = ds1;
    		}
    
    		public void mouseClicked(MouseEvent e)
    		{
    			int xp = e.getX();
    			int yp = e.getY();
    					// 縦表示と横表示の変換
    			if (xp > bx1 && xp < bx1+(bx2-bx1)/2 && yp > by1 && yp < by2) {
    				if (ver) {
    					ver    = false;
    					change = "縦 色";
    				}
    				else {
    					ver    = true;
    					change = "横 色";
    				}
    				repaint();
    			}
    					// グラフの色,線の太さ等
    			else if (xp > bx1+(bx2-bx1)/2 && xp < bx2 && yp > by1 && yp < by2) {
    				Modify md = new Modify(ds);
    				md.setVisible(true);
    			}
    		}
    	}
    
    	/**********************/
    	/* Windowのサイズ変化 */
    	/**********************/
    	class ComponentResize extends ComponentAdapter
    	{
    		public void componentResized(ComponentEvent e)
    		{
    			repaint();
    		}
    	}
    
    	/************/
    	/* 終了処理 */
    	/************/
    	class WinEnd extends WindowAdapter
    	{
    		public void windowClosing(WindowEvent e) {
    			setVisible(false);
    		}
    	}
    }
    
    /****************************/
    /* 円グラフの描画           */
    /*      coded by Y.Suganuma */
    /****************************/
    class PieGraph extends Frame {
    
    	String title;   // グラフのタイトル
    	String item[];   // 凡例
    	double data[];   // データ
    	boolean d_t;   // タイトル表示の有無
    	int width = 900, height = 600;   // Windowの大きさ(初期サイズ)
    	int bx1, bx2, by1, by2;   // 表示切り替えボタンの位置
    	String change = " 色 ";   // 表示切り替えボタン
    	Color cl[] = {Color.black, Color.magenta, Color.blue, Color.orange, Color.cyan,
    	              Color.pink, Color.green, Color.yellow, Color.darkGray, Color.red};   // グラフの色
    	int n_p;   // データの数
    
    	/***********************************/
    	/* コンストラクタ                  */
    	/*      title_i : グラフのタイトル */
    	/*      item_i : 凡例              */
    	/*      data_i : グラフのデータ    */
    	/*      d_t_i : タイトル表示の有無 */
    	/***********************************/
    	PieGraph(String title_i, String item_i[], double data_i[], boolean d_t_i)
    	{
    					// Frameクラスのコンストラクタの呼び出し
    		super("円グラフ");
    					// テーブルデータの保存
    		title = title_i;
    		item  = item_i;
    		data  = data_i;
    		d_t   = d_t_i;
    					// Windowサイズと表示位置を設定
    		setSize(width, height);
    		Toolkit tool = getToolkit();
    		Dimension d  = tool.getScreenSize();
    		setLocation(d.width / 2 - width / 2, d.height / 2 - height / 2);
    					// ウィンドウを表示
    		setVisible(true);
    					// イベントアダプタ
    		addWindowListener(new WinEnd());
    		addComponentListener(new ComponentResize());
    		addMouseListener(new ClickMouse(this));
    	}
    
    	/********/
    	/* 描画 */
    	/********/
    	public void paint (Graphics g)
    	{
    		double r, x1, y1;
    		int i1, a1, a2, k, k1, kx, ky, han, len;
    		int x_l, x_r, y_u, y_d;   // 描画領域
    		int f_size;   // フォントサイズ
    		String s1;
    		Font f;
    		FontMetrics fm;
    					//
    					// Windowサイズの取得
    					//
    		Insets insets = getInsets();
    		Dimension d = getSize();
    		width  = d.width - (insets.left + insets.right);
    		height = d.height - (insets.top + insets.bottom);
    		x_l    = insets.left + 10;
    		x_r    = d.width - insets.right - 10;
    		y_u    = insets.top + 20;
    		y_d    = d.height - insets.bottom;
    					//
    					// グラフタイトルの表示
    					//
    		r      = 0.05;   // タイトル領域の割合
    		f_size = ((y_d - y_u) < (x_r - x_l)) ? (int)((y_d - y_u) * r) : (int)((x_r - x_l) * r);
    		if (f_size < 5)
    			f_size = 5;
    		if (d_t) {
    			f = new Font("TimesRoman", Font.BOLD, f_size);
    			g.setFont(f);
    			fm  = g.getFontMetrics(f);
    			len = fm.stringWidth(title);
    			g.drawString(title, (x_l+x_r)/2-len/2, y_d-f_size/2);
    			y_d -= 3 * f_size / 2;
    		}
    					//
    					// 表示切り替えボタンの設置
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f  = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm = g.getFontMetrics(f);
    		g.setFont(f);
    		g.setColor(Color.yellow);
    		len = fm.stringWidth(change);
    		bx1 = x_r - len - 7 * f_size / 10;
    		by1 = y_u - f_size / 2;
    		bx2 = bx1 + len + f_size / 2;
    		by2 = by1 + 6 * f_size / 5;
    		g.fill3DRect(bx1, by1, len+f_size/2, 6*f_size/5, true);
    		g.setColor(Color.black);
    		g.drawString(change, x_r-len-f_size/2, y_u+f_size/2);
    					//
    					// 凡例の表示
    					//
    		n_p = item.length;
    		han = 0;
    		for (i1 = 0; i1 < n_p; i1++) {
    			len = fm.stringWidth(item[i1]);
    			if (len > han)
    				han = len;
    		}
    		han += 15;
    		r    = 0.2;   // 凡例領域の割合
    		k1   = (int)((x_r - x_l) * r);
    		if (han > k1)
    			han = k1;
    		kx  = x_r - han;
    		ky  = y_u + 3 * f_size / 2;
    		k   = 0;
    		len = 0;
    		DecimalFormat df = new DecimalFormat("#.0");
    		for (i1 = 0; i1 < n_p; i1++) {
    			g.setColor(cl[k]);
    			g.fillRect(kx, ky-3, 10, 6);
    			g.setColor(Color.black);
    			g.drawString(item[i1], kx+15, ky+2*f_size/5);
    			s1 = df.format(data[i1]) + "%";
    			k1 = fm.stringWidth(s1);
    			if (k1 > len)
    				len = k1;
    			g.drawString(s1, kx-k1-5, ky+2*f_size/5);
    			k++;
    			if (k >= cl.length)
    				k = 0;
    			ky += f_size;
    		}
    		x_r -= (han + len + 15);
    					//
    					// グラフの表示
    					//
    		if (x_r-x_l < y_d-y_u)
    			k1 = x_r - x_l;
    		else
    			k1 = y_d - y_u;
    		len = 9 * k1 / 10;
    		kx  = (x_r + x_l - len) / 2;
    		ky  = (y_d + y_u - len) / 2;
    		a1  = 90;
    		a2  = (int)Math.round(3.60 * data[n_p-1]);
    		k--;
    		if (k < 0)
    			k = 9;
    		for (i1 = 0; i1 < n_p; i1++) {
    			g.setColor(cl[k]);
    			g.fillArc(kx, ky, len, len, a1, a2);
    			if (i1 < n_p-1) {
    				a1 += a2;
    				a2  = (int)Math.round(3.60 * data[n_p-2-i1]);
    				k--;
    				if (k < 0)
    					k = cl.length - 1;
    			}
    		}
    	}
    
    	/**********************/
    	/* Windowのサイズ変化 */
    	/**********************/
    	class ComponentResize extends ComponentAdapter
    	{
    		public void componentResized(ComponentEvent e)
    		{
    			repaint();
    		}
    	}
    
    	/************/
    	/* 終了処理 */
    	/************/
    	class WinEnd extends WindowAdapter
    	{
    		public void windowClosing(WindowEvent e) {
    			setVisible(false);
    		}
    	}
    
    	/************************************/
    	/* マウスがクリックされたときの処理 */
    	/************************************/
    	class ClickMouse extends MouseAdapter
    	{
    		PieGraph dp;
    
    		ClickMouse(PieGraph dp1)
    		{
    			dp = dp1;
    		}
    
    		public void mouseClicked(MouseEvent e)
    		{
    			int xp = e.getX();
    			int yp = e.getY();
    					// グラフの色,線の太さ等
    			if (xp > bx1 && xp < bx2 && yp > by1 && yp < by2) {
    				Modify md = new Modify(dp);
    				md.setVisible(true);
    			}
    		}
    	}
    }
    
    /****************************/
    /* 散布図の描画             */
    /*      coded by Y.Suganuma */
    /****************************/
    class ScatterDiagram extends Frame {
    
    	String title[];   // グラフのタイトル
    	double x_scale[];   // x軸目盛り
    	double y_scale[];   // y軸目盛り
    	double data[][];   // データ
    	boolean d_t;   // タイトル表示の有無
    	int place_x;   // 小数点以下の桁数(x軸)
    	int place_y;   // 小数点以下の桁数(y軸)
    	int width = 900, height = 600;   // Windowの大きさ(初期サイズ)
    
    	/*********************************************************/
    	/* コンストラクタ                                        */
    	/*      title_i : グラフ,x軸,及び,y軸のタイトル     */
    	/*      x_scale_i : x軸のデータの最小値,最大値,目盛幅 */
    	/*      y_scale_i : y軸のデータの最小値,最大値,目盛幅 */
    	/*      place_x_i : 小数点以下の桁数(x軸)             */
    	/*      place_y_i : 小数点以下の桁数(y軸)             */
    	/*      data_i : グラフのデータ                          */
    	/*      d_t_i : タイトル表示の有無                       */
    	/*********************************************************/
    	ScatterDiagram(String title_i[], double x_scale_i[],
                       double y_scale_i[], int place_x_i, int place_y_i,
                       double data_i[][], boolean d_t_i)
    	{
    					// Frameクラスのコンストラクタの呼び出し
    		super("散布図");
    					// テーブルデータの保存
    		title   = title_i;
    		x_scale = x_scale_i;
    		y_scale = y_scale_i;
    		place_x = place_x_i;
    		place_y = place_y_i;
    		data    = data_i;
    		d_t     = d_t_i;
    					// Windowサイズと表示位置を設定
    		setSize(width, height);
    		Toolkit tool = getToolkit();
    		Dimension d  = tool.getScreenSize();
    		setLocation(d.width / 2 - width / 2, d.height / 2 - height / 2);
    					// ウィンドウを表示
    		setVisible(true);
    					// イベントアダプタ
    		addWindowListener(new WinEnd());
    		addComponentListener(new ComponentResize());
    	}
    
    	/********/
    	/* 描画 */
    	/********/
    	public void paint (Graphics g)
    	{
    		double r, x1, y1, sp;
    		int i1, cr, k, k1, kx, ky, len;
    		int x_l, x_r, y_u, y_d;   // 描画領域
    		int f_size;   // フォントサイズ
    		int n_p;   // データの数
    		String s1;
    		Font f;
    		FontMetrics fm;
    					//
    					// Windowサイズの取得
    					//
    		Insets insets = getInsets();
    		Dimension d = getSize();
    		width  = d.width - (insets.left + insets.right);
    		height = d.height - (insets.top + insets.bottom);
    		x_l    = insets.left + 10;
    		x_r    = d.width - insets.right - 10;
    		y_u    = insets.top + 20;
    		y_d    = d.height - insets.bottom;
    					//
    					// グラフタイトルの表示
    					//
    		r      = 0.05;   // タイトル領域の割合
    		f_size = ((y_d - y_u) < (x_r - x_l)) ? (int)((y_d - y_u) * r) : (int)((x_r - x_l) * r);
    		if (f_size < 5)
    			f_size = 5;
    		if (d_t) {
    			f = new Font("TimesRoman", Font.BOLD, f_size);
    			g.setFont(f);
    			fm  = g.getFontMetrics(f);
    			len = fm.stringWidth(title[0]);
    			g.drawString(title[0], (x_l+x_r)/2-len/2, y_d-f_size/2);
    			y_d -= f_size;
    		}
    					//
    					// x軸及びy軸のタイトルの表示
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f  = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm = g.getFontMetrics(f);
    		g.setFont(f);
    		if (title[1].length() > 0 && !title[1].equals("-")) {
    			len = fm.stringWidth(title[1]);
    			g.drawString(title[1], (x_l+x_r)/2-len/2, y_d-4*f_size/5);
    			y_d -= 7 * f_size / 4;
    		}
    		else
    			y_d -= f_size / 2;
    		if (title[2].length() > 0 && !title[2].equals("-")) {
    			g.drawString(title[2], x_l, y_u+f_size/2);
    			y_u += f_size;
    		}
    					//
    					// x軸,y軸,及び,各軸の目盛り
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f    = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm   = g.getFontMetrics(f);
    		y_d -= 3 * f_size / 2;
    		n_p  = data[0].length;
    		g.setFont(f);
    							// y軸
    		DecimalFormat df;
    		if (place_y == 0)
    			df = new DecimalFormat("#");
    		else {
    			s1 = "#.";
    			for (i1 = 0; i1 < place_y; i1++)
    				s1 += "0";
    			df = new DecimalFormat(s1);
    		}
    
    		k   = (int)((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		y1  = y_scale[0];
    		len = 0;
    		for (i1 = 0; i1 < k+1; i1++) {
    			s1 = df.format(y1);
    			k1 = fm.stringWidth(s1);
    			if (k1 > len)
    				len = k1;
    			y1 += y_scale[2];
    		}
    		g.drawLine(x_l+len+5, y_u, x_l+len+5, y_d);
    		g.drawLine(x_r, y_u, x_r, y_d);
    		y1 = y_scale[0];
    		x1 = y_d;
    		sp = (double)(y_d - y_u) / k;
    		for (i1 = 0; i1 < k+1; i1++) {
    			ky = (int)Math.round(x1);
    			s1 = df.format(y1);
    			k1 = fm.stringWidth(s1);
    			g.drawString(s1, x_l+len-k1, ky+f_size/2);
    			g.drawLine(x_l+len+5, ky, x_r, ky);
    			y1 += y_scale[2];
    			x1 -= sp;
    		}
    		x_l += (len + 5);
    							// x軸
    		if (place_x == 0)
    			df = new DecimalFormat("#");
    		else {
    			s1 = "#.";
    			for (i1 = 0; i1 < place_x; i1++)
    				s1 += "0";
    			df = new DecimalFormat(s1);
    		}
    
    		k  = (int)((x_scale[1] - x_scale[0]) / (0.99 * x_scale[2]));
    		x1 = x_scale[0];
    		y1 = x_l;
    		sp = (double)(x_r - x_l) / k;
    		for (i1 = 0; i1 < k+1; i1++) {
    			kx = (int)Math.round(y1);
    			s1 = df.format(x1);
    			k1 = fm.stringWidth(s1);
    			g.drawString(s1, kx-k1/2, y_d+6*f_size/5);
    			if (i1 < k)
    				g.drawLine(kx, y_d, kx, y_u);
    			x1 += x_scale[2];
    			y1 += sp;
    		}
    					//
    					// グラフの表示
    					//
    		cr = f_size / 2;
    		if (cr == 0)
    			cr = 1;
    		for (i1 = 0; i1 < n_p; i1++) {
    			kx = x_l + (int)((x_r - x_l) * (data[0][i1] - x_scale[0]) / (x_scale[1] - x_scale[0]));
    			ky = y_d - (int)((y_d - y_u) * (data[1][i1] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    			g.fillOval(kx-cr/2, ky-cr/2, cr, cr);
    		}
    					//
    					// 相関係数
    					//
    		double vii = 0.0, vjj = 0.0, vij = 0.0, mi = 0.0, mj = 0.0;
    		for (i1 = 0; i1 < n_p; i1++) {
    			mi += data[0][i1];
    			mj += data[1][i1];
    		}
    		mi /= n_p;
    		mj /= n_p;
    		for (i1 = 0; i1 < n_p; i1++) {
    			vii += (data[0][i1] - mi) * (data[0][i1] - mi);
    			vjj += (data[1][i1] - mj) * (data[1][i1] - mj);
    			vij += (data[0][i1] - mi) * (data[1][i1] - mj);
    		}
    		vii /= (n_p - 1);
    		vjj /= (n_p - 1);
    		vij /= (n_p - 1);
    		x1   = vij / (Math.sqrt(vii) * Math.sqrt(vjj));
    		df   = new DecimalFormat("0.000");
    		s1   = "相関係数: " + df.format(x1);
    		k1   = fm.stringWidth(s1);
    		g.drawString(s1, x_r-k1, y_u-f_size/2);
    	}
    
    	/**********************/
    	/* Windowのサイズ変化 */
    	/**********************/
    	class ComponentResize extends ComponentAdapter
    	{
    		public void componentResized(ComponentEvent e)
    		{
    			repaint();
    		}
    	}
    
    	/************/
    	/* 終了処理 */
    	/************/
    	class WinEnd extends WindowAdapter
    	{
    		public void windowClosing(WindowEvent e) {
    			setVisible(false);
    		}
    	}
    }
    
    /****************************/
    /* レーダーチャートの描画   */
    /*      coded by Y.Suganuma */
    /****************************/
    class RadarChart extends Frame {
    
    	String title;   // グラフのタイトル
    	String g_title[];   // 凡例(グラフの内容)
    	String item[];   // 項目
    	double scale[];   // 目盛り
    	double data[][];   // データ
    	boolean d_t;   // タイトル表示の有無
    	boolean d_g;   // 凡例表示の有無
    	int place;   // 小数点以下の桁数
    	int width = 900, height = 600;   // Windowの大きさ(初期サイズ)
    	int bx1, bx2, by1, by2;   // 表示切り替えボタンの位置
    	String change = " 色 ";   // 表示切り替えボタン
    	float line_w = 1.0f;   // 折れ線グラフ等の線の太さ
    	boolean line_m = true;   // 折れ線グラフ等にマークを付けるか否か
    	Color cl[] = {Color.black, Color.magenta, Color.blue, Color.orange, Color.cyan,
    	              Color.pink, Color.green, Color.yellow, Color.darkGray, Color.red};   // グラフの色
    	int n_g;   // グラフの数
    
    	/*************************************************/
    	/* コンストラクタ                                */
    	/*      title_i : グラフのタイトル               */
    	/*      g_title_i : 凡例(グラフの内容)         */
    	/*      item_i : 項目                            */
    	/*      scale_i : データの最小値,最大値,目盛幅 */
    	/*      place_i : 小数点以下の桁数               */
    	/*      data_i : グラフのデータ                  */
    	/*      d_t_i : タイトル表示の有無               */
    	/*      d_g_i : 凡例表示の有無                   */
    	/*************************************************/
    	RadarChart(String title_i, String g_title_i[], String item_i[],
                   double scale_i[], int place_i, double data_i[][],
                   boolean d_t_i, boolean d_g_i)
    	{
    					// Frameクラスのコンストラクタの呼び出し
    		super("レーダーチャート");
    					// テーブルデータの保存
    		title   = title_i;
    		g_title = g_title_i;
    		item    = item_i;
    		scale   = scale_i;
    		place   = place_i;
    		data    = data_i;
    		d_t     = d_t_i;
    		d_g     = d_g_i;
    					// Windowサイズと表示位置を設定
    		setSize(width, height);
    		Toolkit tool = getToolkit();
    		Dimension d  = tool.getScreenSize();
    		setLocation(d.width / 2 - width / 2, d.height / 2 - height / 2);
    					// ウィンドウを表示
    		setVisible(true);
    					// イベントアダプタ
    		addWindowListener(new WinEnd());
    		addComponentListener(new ComponentResize());
    		addMouseListener(new ClickMouse(this));
    	}
    
    	/********/
    	/* 描画 */
    	/********/
    	public void paint (Graphics g)
    	{
    		double a, as, r, xx, x0, x11, x12, x21, x22, yy, y0, y11, y12, y21, y22, sp;
    		int i1, i2, cx, cy, cr, k, k1, kx, kx0, kx1, kx2, ky, ky0, ky1, ky2, han, len, pt;
    		int x_l, x_r, y_u, y_d;   // 描画領域
    		int f_size;   // フォントサイズ
    		int n_p;   // 項目の数
    		String s1;
    		Font f;
    		FontMetrics fm;
    		Graphics2D g2 = (Graphics2D)g;
    					//
    					// Windowサイズの取得
    					//
    		Insets insets = getInsets();
    		Dimension d = getSize();
    		width  = d.width - (insets.left + insets.right);
    		height = d.height - (insets.top + insets.bottom);
    		x_l    = insets.left + 10;
    		x_r    = d.width - insets.right - 10;
    		y_u    = insets.top + 20;
    		y_d    = d.height - insets.bottom;
    					//
    					// グラフタイトルの表示
    					//
    		r      = 0.05;   // タイトル領域の割合
    		f_size = ((y_d - y_u) < (x_r - x_l)) ? (int)((y_d - y_u) * r) : (int)((x_r - x_l) * r);
    		if (f_size < 5)
    			f_size = 5;
    		if (d_t) {
    			f = new Font("TimesRoman", Font.BOLD, f_size);
    			g.setFont(f);
    			fm  = g.getFontMetrics(f);
    			len = fm.stringWidth(title);
    			g.drawString(title, (x_l+x_r)/2-len/2, y_d-f_size/2);
    			y_d -= 3*f_size/2;
    		}
    					//
    					// 表示切り替えボタンの設置
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f  = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm = g.getFontMetrics(f);
    		g.setFont(f);
    		g.setColor(Color.yellow);
    		len = fm.stringWidth(change);
    		bx1 = x_r - len - 7 * f_size / 10;
    		by1 = y_u - f_size / 2;
    		bx2 = bx1 + len + f_size / 2;
    		by2 = by1 + 6 * f_size / 5;
    		g.fill3DRect(bx1, by1, len+f_size/2, 6*f_size/5, true);
    		g.setColor(Color.black);
    		g.drawString(change, x_r-len-f_size/2, y_u+f_size/2);
    					//
    					// 凡例の表示
    					//
    		n_g = g_title.length;
    		if (d_g) {
    			han = 0;
    			for (i1 = 0; i1 < n_g; i1++) {
    				len = fm.stringWidth(g_title[i1]);
    				if (len > han)
    					han = len;
    			}
    			han += 15;
    			r    = 0.2;   // 凡例領域の割合
    			k1   = (int)((x_r - x_l) * r);
    			if (han > k1)
    				han = k1;
    			kx = x_r - han;
    			ky = y_u + 3 * f_size / 2;
    			k  = 0;
    			g2.setStroke(new BasicStroke(7.0f));
    			for (i1 = 0; i1 < n_g; i1++) {
    				g.setColor(cl[k]);
    				g.drawLine(kx, ky-1, kx+10, ky-1);
    				g.drawLine(kx, ky, kx+10, ky);
    				g.setColor(Color.black);
    				g.drawString(g_title[i1], kx+15, ky+2*f_size/5);
    				k++;
    				if (k >= cl.length)
    					k = 0;
    				ky += f_size;
    			}
    			g2.setStroke(new BasicStroke(1.0f));
    			x_r -= (han + 10);
    		}
    		else
    			x_r -= (int)(0.03 * (x_r - x_l));
    					//
    					// 軸,及び,軸の目盛り
    					//
    						// フォントサイズ
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f  = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm = g.getFontMetrics(f);
    		g.setFont(f);
    
    		DecimalFormat df;
    		if (place == 0)
    			df = new DecimalFormat("#");
    		else {
    			s1 = "#.";
    			for (i1 = 0; i1 < place; i1++)
    				s1 += "0";
    			df = new DecimalFormat(s1);
    		}
    						// 大きさの決定
    		n_p = item.length;
    		a   = 0.5 * Math.PI;
    		as  = 2.0 * Math.PI / n_p;
    		x11 = 0.0;
    		x12 = 0.0;
    		x21 = 0.0;
    		x22 = 0.0;
    		y11 = 0.0;
    		y12 = 0.0;
    		y21 = 0.0;
    		y22 = 0.0;
    		for (i1 = 0; i1 < n_p; i1++) {
    			xx = 100 * Math.cos(a);
    			yy = 100 * Math.sin(a);
    			k1 = fm.stringWidth(item[i1]);
    			if (i1 == 0) {
    				x12 = 0.5 * k1;
    				x22 = x12;
    				y11 = 100.0;
    				y12 = 5.0 * f_size / 4.0;
    			}
    			else if (Math.abs(xx) < 1.0e-5) {
    				x0 = 0.5 * k1;
    				if (x0 > x12)
    					x12 = x0;
    				if (x0 > x22)
    					x22 = x0;
    				y21 = 100.0;
    				y22 = f_size + 5.0;
    			}
    			else {
    				if (yy < 0.0) {
    					y0 = -yy + 0.5 * f_size;
    					if (y0 > y21+y22) {
    						y21 = -yy;
    						y22 = 0.5 * f_size;
    					}
    				}
    				if (xx > 0.0) {
    					x0 = xx + k1 + 5.0;
    					if (x0 > x21+x22) {
    						x21 = xx;
    						x22 = k1 + 5.0;
    					}
    				}
    				else {
    					x0 = -xx + k1 + 5.0;
    					if (x0 > x11+x12) {
    						x11 = -xx;
    						x12 = k1 + 5.0;
    					}
    				}
    			}
    			a += as;
    		}
    		x0 = x12 + x22;
    		xx = (x_r - x_l - x0 - 10) / (x11 + x21);
    		y0 = y12 + y22;
    		yy = (y_d - y_u - y0 - 10) / (y11 + y21);
    		r  = (xx < yy) ? xx : yy;
    		cr = (int)(100 * r);
    		xx = x_l + r * x11 + x12 + 5.0;
    		cx = (int)(xx + (x_r - x_l - r * x11 - x12 - r * x21 - x22 - 5) / 2);
    		yy = y_u + r * y11 + y12 + 5.0;
    		cy = (int)(yy + (y_d - y_u - r * y11 - y12 - r * y21 - y22 - 5) / 2);
    						// 軸とタイトルの描画
    		k  = (int)((scale[1] - scale[0]) / (0.99 * scale[2])) + 1;
    		xx = (double)cr / k;
    		a  = 0.5 * Math.PI;
    		as = 2.0 * Math.PI / n_p;
    		for (i1 = 0; i1 < n_p; i1++) {
    			kx = (int)Math.round(cr * Math.cos(a));
    			ky = (int)Math.round(cr * Math.sin(a));
    			k1 = fm.stringWidth(item[i1]);
    			g.drawLine(cx, cy, cx+kx, cy-ky);
    			yy = xx;
    			for (i2 = 0; i2 < k; i2++) {
    				kx0 = cx + (int)Math.round(yy * Math.cos(a));
    				ky0 = cy - (int)Math.round(yy * Math.sin(a));
    				kx1 = kx0 + (int)Math.round(3 * Math.cos(a+0.5*Math.PI));
    				ky1 = ky0 - (int)Math.round(3 * Math.sin(a+0.5*Math.PI));
    				kx2 = kx0 + (int)Math.round(3 * Math.cos(a-0.5*Math.PI));
    				ky2 = ky0 - (int)Math.round(3 * Math.sin(a-0.5*Math.PI));
    				g.drawLine(kx1, ky1, kx2, ky2);
    				yy += xx;
    			}
    			if (i1 == 0) {
    				g.drawString(item[i1], cx+kx-k1/2, cy-ky-5*f_size/4);
    				yy = xx;
    				sp = scale[0];
    				for (i2 = 0; i2 < k; i2++) {
    					s1  = df.format(sp);
    					kx0 = cx + (int)Math.round(yy * Math.cos(a)) + 5;
    					ky0 = cy - (int)Math.round(yy * Math.sin(a)) + 2 * f_size / 5;
    					g.drawString(s1, kx0, ky0);
    					yy += xx;
    					sp += scale[2];
    				}
    			}
    			else if (kx == 0)
    				g.drawString(item[i1], cx+kx-k1/2, cy-ky+f_size+5);
    			else if (kx > 0)
    				g.drawString(item[i1], cx+kx+5, cy-ky+f_size/2);
    			else
    				g.drawString(item[i1], cx+kx-k1-5, cy-ky+f_size/2);
    			a += as;
    		}
    					//
    					// グラフの表示
    					//
    		g2.setStroke(new BasicStroke(line_w));
    		pt = (int)line_w + 6;
    		k1 = 0;
    		for (i1 = 0; i1 < n_g; i1++) {
    			g.setColor(cl[k1]);
    			a   = 0.5 * Math.PI;
    			as  = 2.0 * Math.PI / n_p;
    			kx1 = 0;
    			ky1 = 0;
    			kx2 = 0;
    			ky2 = 0;
    			for (i2 = 0; i2 < n_p; i2++) {
    				yy = xx + (cr - xx) * (data[i1][i2] - scale[0]) / (scale[1] - scale[0]);
    				kx = cx + (int)Math.round(yy * Math.cos(a));
    				ky = cy - (int)Math.round(yy * Math.sin(a));
    				if (line_m)
    					g.fillOval(kx-pt/2, ky-pt/2, pt, pt);
    				if (i2 == 0) {
    					kx2 = kx;
    					ky2 = ky;
    				}
    				else {
    					g.drawLine(kx1, ky1, kx, ky);
    					if (i2 == n_p-1)
    						g.drawLine(kx2, ky2, kx, ky);
    				}
    				kx1  = kx;
    				ky1  = ky;
    				a   += as;
    			}
    			k1++;
    			if (k1 >= cl.length)
    				k1 = 0;
    		}
    		g2.setStroke(new BasicStroke(1.0f));
    	}
    
    	/**********************/
    	/* Windowのサイズ変化 */
    	/**********************/
    	class ComponentResize extends ComponentAdapter
    	{
    		public void componentResized(ComponentEvent e)
    		{
    			repaint();
    		}
    	}
    
    	/************/
    	/* 終了処理 */
    	/************/
    	class WinEnd extends WindowAdapter
    	{
    		public void windowClosing(WindowEvent e) {
    			setVisible(false);
    		}
    	}
    
    	/************************************/
    	/* マウスがクリックされたときの処理 */
    	/************************************/
    	class ClickMouse extends MouseAdapter
    	{
    		RadarChart da;
    
    		ClickMouse(RadarChart da1)
    		{
    			da = da1;
    		}
    
    		public void mouseClicked(MouseEvent e)
    		{
    			int xp = e.getX();
    			int yp = e.getY();
    					// グラフの色,線の太さ等
    			if (xp > bx1 && xp < bx2 && yp > by1 && yp < by2) {
    				Modify md = new Modify(da);
    				md.setVisible(true);
    			}
    		}
    	}
    }
    
    /****************************/
    /* ボード線図の描画         */
    /*      coded by Y.Suganuma */
    /****************************/
    class Bode extends Frame {
    
    	String title[];   // グラフのタイトル
    	String g_title[];   // 凡例(グラフの内容)
    	double xx_scale[];   // y軸目盛り
    	double x_scale[];   // 元のy軸目盛り
    	double y_scale[];   // y軸目盛り
    	double data_x[][];   // 元のデータ
    	double data_xx[][], data_y[][];   // データ
    	boolean d_t;   // タイトル表示の有無
    	boolean d_g;   // 凡例表示の有無
    	boolean log_c = false;   // 対数に変換したか否か
    	int place_x;   // 小数点以下の桁数(x軸)
    	int place_y;   // 小数点以下の桁数(y軸)
    	int width = 900, height = 600;   // Windowの大きさ(初期サイズ)
    	int bx1, bx2, by1, by2;   // 表示切り替えボタンの位置
    	String change = " 色 ";   // 表示切り替えボタン
    	float line_w = 1.0f;   // 折れ線グラフ等の線の太さ
    	Color cl[] = {Color.black, Color.magenta, Color.blue, Color.orange, Color.cyan,
    	              Color.pink, Color.green, Color.yellow, Color.darkGray, Color.red};   // グラフの色
    	int n_g;   // グラフの数
    
    	/*********************************************************/
    	/* コンストラクタ                                        */
    	/*      title_i : グラフ,x軸,及び,y軸のタイトル     */
    	/*      g_title_i : 凡例                                 */
    	/*      x_scale_i : データの最小値,最大値,目盛幅(y) */
    	/*      place_x_i : 小数点以下の桁数(x軸)             */
    	/*      y_scale_i : データの最小値,最大値,目盛幅(y) */
    	/*      place_y_i : 小数点以下の桁数(y軸)             */
    	/*      data_x_i : グラフのデータ(x軸)                */
    	/*      data_y_i : グラフのデータ(y軸)                */
    	/*      d_t_i : タイトル表示の有無                       */
    	/*      d_g_i : 凡例表示の有無                           */
    	/*********************************************************/
    	Bode(String title_i[], String g_title_i[], double x_scale_i[],
                  int place_x_i, double y_scale_i[], int place_y_i,
                  double data_x_i[][], double data_y_i[][], boolean d_t_i,
                  boolean d_g_i)
    	{
    					// Frameクラスのコンストラクタの呼び出し
    		super("ボード線図");
    					// テーブルデータの保存
    		title   = title_i;
    		g_title = g_title_i;
    		x_scale = x_scale_i;
    		place_x = place_x_i;
    		y_scale = y_scale_i;
    		place_y = place_y_i;
    		data_x  = data_x_i;
    		data_y  = data_y_i;
    		d_t     = d_t_i;
    		d_g     = d_g_i;
    
    		int i1, i2;
    		int n_g = g_title.length;
    		int n_p = data_x[0].length;
    		xx_scale  = new double [3];
    		data_xx   = new double [n_g][n_p];
    		xx_scale[0] = x_scale[0];
    		xx_scale[1] = x_scale[1];
    		for (i1 = 0; i1 < n_g; i1++) {
    			for (i2 = 0; i2 < n_p; i2++)
    				data_xx[i1][i2] = data_x[i1][i2];
    		}
    					// Windowサイズと表示位置を設定
    		setSize(width, height);
    		Toolkit tool = getToolkit();
    		Dimension d  = tool.getScreenSize();
    		setLocation(d.width / 2 - width / 2, d.height / 2 - height / 2);
    					// ウィンドウを表示
    		setVisible(true);
    					// イベントアダプタ
    		addWindowListener(new WinEnd());
    		addComponentListener(new ComponentResize());
    		addMouseListener(new ClickMouse(this));
    	}
    
    	/********/
    	/* 描画 */
    	/********/
    	public void paint (Graphics g)
    	{
    		double r, x1, y1, y2, sp, x_scale_org = 0.0;
    		int i1, i2, cr, k, k_x, k_y, k1, k2, kx, kx1, ky, ky1, han, len;
    		int x_l, x_r, y_u, y_d;   // 描画領域
    		int f_size;   // フォントサイズ
    		int n_p;   // データの数
    		String s1;
    		Font f;
    		FontMetrics fm;
    		Graphics2D g2 = (Graphics2D)g;
    					//
    					// Windowサイズの取得
    					//
    		Insets insets = getInsets();
    		Dimension d = getSize();
    		width  = d.width - (insets.left + insets.right);
    		height = d.height - (insets.top + insets.bottom);
    		x_l    = insets.left + 10;
    		x_r    = d.width - insets.right - 10;
    		y_u    = insets.top + 20;
    		y_d    = d.height - insets.bottom;
    					//
    					// グラフタイトルの表示
    					//
    		r      = 0.05;   // タイトル領域の割合
    		f_size = ((y_d - y_u) < (x_r - x_l)) ? (int)((y_d - y_u) * r) : (int)((x_r - x_l) * r);
    		if (f_size < 5)
    			f_size = 5;
    		if (d_t) {
    			f = new Font("TimesRoman", Font.BOLD, f_size);
    			g.setFont(f);
    			fm  = g.getFontMetrics(f);
    			len = fm.stringWidth(title[0]);
    			g.drawString(title[0], (x_l+x_r)/2-len/2, y_d-f_size/2);
    			y_d -= f_size;
    		}
    					//
    					// 表示切り替えボタンの設置
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f  = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm = g.getFontMetrics(f);
    		g.setFont(f);
    		g.setColor(Color.yellow);
    		len = fm.stringWidth(change);
    		bx1 = x_r - len - 7 * f_size / 10;
    		by1 = y_u - f_size / 2;
    		bx2 = bx1 + len + f_size / 2;
    		by2 = by1 + 6 * f_size / 5;
    		g.fill3DRect(bx1, by1, len+f_size/2, 6*f_size/5, true);
    		g.setColor(Color.black);
    		g.drawString(change, x_r-len-f_size/2, y_u+f_size/2);
    					//
    					// 凡例の表示
    					//
    		n_g = g_title.length;
    		if (d_g) {
    			han = 0;
    			for (i1 = 0; i1 < n_g; i1++) {
    				len = fm.stringWidth(g_title[i1]);
    				if (len > han)
    					han = len;
    			}
    			han += 15;
    			r    = 0.2;   // 凡例領域の割合
    			k1   = (int)((x_r - x_l) * r);
    			if (han > k1)
    				han = k1;
    			kx = x_r - han;
    			ky = y_u + 3 * f_size / 2;
    			k  = 0;
    			g2.setStroke(new BasicStroke(7.0f));
    			for (i1 = 0; i1 < n_g; i1++) {
    				g.setColor(cl[k]);
    				g.drawLine(kx, ky, kx+10, ky);
    				g.setColor(Color.black);
    				g.drawString(g_title[i1], kx+15, ky+2*f_size/5);
    				k++;
    				if (k >= cl.length)
    					k = 0;
    				ky += f_size;
    			}
    			g2.setStroke(new BasicStroke(1.0f));
    			x_r -= (han + 10);
    		}
    		else
    			x_r -= (int)(0.03 * (x_r - x_l));
    					//
    					// x軸の対数
    					//
    		n_p         = data_x[0].length;
    		x_scale_org = x_scale[0];
    		xx_scale[0] = Math.log(x_scale[0]) / Math.log(10.0);
    		xx_scale[1] = Math.log(x_scale[1]) / Math.log(10.0);
    		xx_scale[2] = 1.0;
    		for (i1 = 0; i1 < n_g; i1++) {
    			for (i2 = 0; i2 < n_p; i2++)
    				data_xx[i1][i2] = Math.log(data_x[i1][i2]) / Math.log(10.0);
    		}
    					//
    					// x軸及びy軸のタイトルの表示
    					//
    		if (title[1].length() > 0 && !title[1].equals("-")) {
    			len = fm.stringWidth(title[1]);
    			g.drawString(title[1], (x_l+x_r)/2-len/2, y_d-4*f_size/5);
    			y_d -= 7 * f_size / 4;
    		}
    		else
    			y_d -= f_size / 2;
    		if (title[2].length() > 0 && !title[2].equals("-")) {
    			g.drawString(title[2], x_l, y_u+f_size/2);
    			y_u += f_size;
    		}
    					//
    					// x軸,y軸,及び,各軸の目盛り
    					//
    		f_size = (int)(0.8 * f_size);
    		if (f_size < 5)
    			f_size = 5;
    		f    = new Font("TimesRoman", Font.PLAIN, f_size);
    		fm   = g.getFontMetrics(f);
    		y_d -= 3 * f_size / 2;
    		k_y  = (int)((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		k_x  = (int)((xx_scale[1] - xx_scale[0]) / (0.99 * xx_scale[2]));
    		g.setFont(f);
    
    		DecimalFormat df_x, df_y;
    		df_x = new DecimalFormat("#");
    		df_y = new DecimalFormat("#");
    		if (place_x != 0) {
    			s1 = "0.";
    			for (i1 = 0; i1 < place_x; i1++)
    				s1 += "0";
    			df_x = new DecimalFormat(s1);
    		}
    		if (place_y != 0) {
    			s1 = "#.";
    			for (i1 = 0; i1 < place_y; i1++)
    				s1 += "0";
    			df_y = new DecimalFormat(s1);
    		}
    						// y軸
    		y1  = y_scale[0];
    		len = 0;
    		for (i1 = 0; i1 < k_y+1; i1++) {
    			s1 = df_y.format(y1);
    			k1 = fm.stringWidth(s1);
    			if (k1 > len)
    				len = k1;
    			y1 += y_scale[2];
    		}
    		g.drawLine(x_l+len+5, y_u, x_l+len+5, y_d);
    		g.drawLine(x_r, y_u, x_r, y_d);
    		y1 = y_scale[0];
    		x1 = y_d;
    		sp = (double)(y_d - y_u) / k_y;
    		for (i1 = 0; i1 < k_y+1; i1++) {
    			ky = (int)Math.round(x1);
    			s1 = df_y.format(y1);
    			k1 = fm.stringWidth(s1);
    			g.drawString(s1, x_l+len-k1, ky+f_size/2);
    			g.drawLine(x_l+len+5, ky, x_r, ky);
    			y1 += y_scale[2];
    			x1 -= sp;
    		}
    		x_l += (len + 5);
    						// x軸
    		x1 = x_scale_org;
    		y1 = x_l;
    		sp = (double)(x_r - x_l) / k_x;
    		for (i1 = 0; i1 < k_x+1; i1++) {
    			kx = (int)Math.round(y1);
    			s1 = df_x.format(x1);
    			k1 = fm.stringWidth(s1);
    			g.drawString(s1, kx-k1/2, y_d+6*f_size/5);
    			g.drawLine(kx, y_d, kx, y_u);
    			if (i1 != k_x) {
    				g.setColor(Color.darkGray);
    				for (i2 = 2; i2 <= 9; i2++) {
    					y2 = Math.log(x1 * i2) / Math.log(10.0);
    					kx = x_l + (int)Math.round(((x_r - x_l) * (y2 - xx_scale[0]) / (xx_scale[1] - xx_scale[0])));
    					g.drawLine(kx, y_d, kx, y_u);
    				}
    				g.setColor(Color.black);
    			}
    			x1 *= 10.0;
    			y1 += sp;
    		}
    					//
    					// グラフの表示
    					//
    		g2.setStroke(new BasicStroke(line_w));
    		k1  = 0;
    		for (i1 = 0; i1 < n_g; i1++) {
    			g.setColor(cl[k1]);
    			kx1 = 0;
    			ky1 = 0;
    			for (i2 = 0; i2 < n_p; i2++) {
    				kx = x_l + (int)((x_r - x_l) * (data_xx[i1][i2] - xx_scale[0]) / (xx_scale[1] - xx_scale[0]));
    				ky = y_d - (int)((y_d - y_u) * (data_y[i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    				if (i2 > 0)
    					g.drawLine(kx1, ky1, kx, ky);
    				kx1 = kx;
    				ky1 = ky;
    			}
    			k1++;
    			if (k1 >= cl.length)
    				k1 = 0;
    		}
    		g2.setStroke(new BasicStroke(1.0f));
    	}
    
    	/**********************/
    	/* Windowのサイズ変化 */
    	/**********************/
    	class ComponentResize extends ComponentAdapter
    	{
    		public void componentResized(ComponentEvent e)
    		{
    			repaint();
    		}
    	}
    
    	/************/
    	/* 終了処理 */
    	/************/
    	class WinEnd extends WindowAdapter
    	{
    		public void windowClosing(WindowEvent e) {
    			setVisible(false);
    		}
    	}
    
    	/************************************/
    	/* マウスがクリックされたときの処理 */
    	/************************************/
    	class ClickMouse extends MouseAdapter
    	{
    		Bode dd;
    
    		ClickMouse(Bode dd1)
    		{
    			dd = dd1;
    		}
    
    		public void mouseClicked(MouseEvent e)
    		{
    			int xp = e.getX();
    			int yp = e.getY();
    					// グラフの色,線の太さ等
    			if (xp > bx1 && xp < bx2 && yp > by1 && yp < by2) {
    				Modify md = new Modify(dd);
    				md.setVisible(true);
    			}
    		}
    	}
    }
    
    /****************************/
    /* 色及び線の太さの変更     */
    /*      coded by Y.Suganuma */
    /****************************/
    class Modify extends Dialog implements ActionListener, TextListener {
    	LineGraph dr;   // 折れ線グラフ
    	Button bt_dr;
    	StackGraph ds;   // 積み上げ棒グラフ
    	Button bt_ds;
    	BarGraph db;   // 棒グラフ
    	Button bt_db;
    	Bode dd;   // ボード線図
    	Button bt_dd;
    	PieGraph dp;   // 円グラフ
    	Button bt_dp;
    	RadarChart da;   // レーダーチャート
    	Button bt_da;
    	TextField rgb[];
    	TextField r[];
    	TextField g[];
    	TextField b[];
    	TextField tx;
    	Checkbox r1, r2;
    	float line_w = 1.0f;   // 折れ線グラフ等の線の太さ
    	boolean line_m = true;   // 折れ線グラフ等にマークを付けるか否か
    	Color cl[];   // グラフの色
    	int n_g;   // グラフの数
    	int wd;   // 線の太さを変更するか
    	int mk;   // マークを変更するか
    	int n;
    	Panel jp[];
    					// 折れ線グラフ
    	Modify(LineGraph dr1)
    	{
    		super(dr1, "色と線の変更", true);
    							// 初期設定
    		Font f = new Font("TimesRoman", Font.BOLD, 20);
    		setFont(f);
    		dr  = dr1;
    		wd  = 1;
    		mk  = 1;
    		n_g = dr.n_g;
    		if (n_g > 10)
    			n_g = 10;
    		n      = n_g + 3;
    		line_w = dr.line_w;
    		line_m = dr.line_m;
    		cl     = new Color[n_g];
    		for (int i1 = 0; i1 < n_g; i1++)
    			cl[i1] = dr.cl[i1];
    		set();
    							// ボタン
    		bt_dr = new Button("OK");
    		bt_dr.addActionListener(this);
    		jp[n-1].add(bt_dr);
    	}
    					// 積み上げ棒グラフ
    	Modify(StackGraph ds1)
    	{
    		super(ds1, "色の変更", true);
    							// 初期設定
    		Font f = new Font("TimesRoman", Font.BOLD, 20);
    		setFont(f);
    		ds  = ds1;
    		wd  = 0;
    		mk  = 0;
    		n_g = ds.n_p;
    		if (n_g > 10)
    			n_g = 10;
    		n  = n_g + 1;
    		cl = new Color[n_g];
    		for (int i1 = 0; i1 < n_g; i1++)
    			cl[i1] = ds.cl[i1];
    		set();
    							// ボタン
    		bt_ds = new Button("OK");
    		bt_ds.addActionListener(this);
    		jp[n-1].add(bt_ds);
    	}
    					// 棒グラフ
    	Modify(BarGraph db1)
    	{
    		super(db1, "色の変更", true);
    							// 初期設定
    		Font f = new Font("TimesRoman", Font.BOLD, 20);
    		setFont(f);
    		db  = db1;
    		wd  = 0;
    		mk  = 0;
    		n_g = db.n_g;
    		if (n_g > 10)
    			n_g = 10;
    		n  = n_g + 1;
    		cl = new Color[n_g];
    		for (int i1 = 0; i1 < n_g; i1++)
    			cl[i1] = db.cl[i1];
    		set();
    							// ボタン
    		bt_db = new Button("OK");
    		bt_db.addActionListener(this);
    		jp[n-1].add(bt_db);
    	}
    					// ボード線図
    	Modify(Bode dd1)
    	{
    		super(dd1, "色と線の変更", true);
    							// 初期設定
    		Font f = new Font("TimesRoman", Font.BOLD, 20);
    		setFont(f);
    		dd  = dd1;
    		wd  = 1;
    		mk  = 0;
    		n_g = dd.n_g;
    		if (n_g > 10)
    			n_g = 10;
    		n      = n_g + 2;
    		line_w = dd.line_w;
    		cl     = new Color[n_g];
    		for (int i1 = 0; i1 < n_g; i1++)
    			cl[i1] = dd.cl[i1];
    		set();
    							// ボタン
    		bt_dd = new Button("OK");
    		bt_dd.addActionListener(this);
    		jp[n-1].add(bt_dd);
    	}
    					// 円グラフ
    	Modify(PieGraph dp1)
    	{
    		super(dp1, "色の変更", true);
    							// 初期設定
    		Font f = new Font("TimesRoman", Font.BOLD, 20);
    		setFont(f);
    		dp  = dp1;
    		wd  = 0;
    		mk  = 0;
    		n_g = dp.n_p;
    		if (n_g > 10)
    			n_g = 10;
    		n  = n_g + 1;
    		cl = new Color[n_g];
    		for (int i1 = 0; i1 < n_g; i1++)
    			cl[i1] = dp.cl[i1];
    		set();
    							// ボタン
    		bt_dp = new Button("OK");
    		bt_dp.addActionListener(this);
    		jp[n-1].add(bt_dp);
    	}
    					// レーダーチャート
    	Modify(RadarChart da1)
    	{
    		super(da1, "色と線の変更", true);
    							// 初期設定
    		Font f = new Font("TimesRoman", Font.BOLD, 20);
    		setFont(f);
    		da  = da1;
    		wd  = 1;
    		mk  = 1;
    		n_g = da.n_g;
    		if (n_g > 10)
    			n_g = 10;
    		n      = n_g + 3;
    		line_w = da.line_w;
    		line_m = da.line_m;
    		cl     = new Color[n_g];
    		for (int i1 = 0; i1 < n_g; i1++)
    			cl[i1] = da.cl[i1];
    		set();
    							// ボタン
    		bt_da = new Button("OK");
    		bt_da.addActionListener(this);
    		jp[n-1].add(bt_da);
    	}
    					// 設定
    	void set()
    	{
    		setSize(450, 60*(n));
    		setBackground(Color.white);
    		setLayout(new GridLayout(n, 1, 5, 5));
    		jp = new Panel[n];
    		for (int i1 = 0; i1 < n; i1++) {
    			jp[i1] = new Panel();
    			add(jp[i1]);
    		}
    							// 色の変更
    		Label lb[][] = new Label[n_g][3];
    		rgb = new TextField[n_g];
    		r = new TextField[n_g];
    		g = new TextField[n_g];
    		b = new TextField[n_g];
    		for (int i1 = 0; i1 < n_g; i1++) {
    			rgb[i1] = new TextField(3);
    			rgb[i1].setBackground(new Color(cl[i1].getRed(), cl[i1].getGreen(), cl[i1].getBlue()));
    			jp[i1].add(rgb[i1]);
    			lb[i1][0] = new Label(" 赤");
    			jp[i1].add(lb[i1][0]);
    			r[i1] = new TextField(3);
    			r[i1].setBackground(Color.white);
    			r[i1].setText(Integer.toString(cl[i1].getRed()));
    			r[i1].addTextListener(this);
    			jp[i1].add(r[i1]);
    			lb[i1][1] = new Label("緑");
    			jp[i1].add(lb[i1][1]);
    			g[i1] = new TextField(3);
    			g[i1].setBackground(Color.white);
    			g[i1].setText(Integer.toString(cl[i1].getGreen()));
    			g[i1].addTextListener(this);
    			jp[i1].add(g[i1]);
    			lb[i1][2] = new Label("青");
    			jp[i1].add(lb[i1][2]);
    			b[i1] = new TextField(3);
    			b[i1].setBackground(Color.white);
    			b[i1].setText(Integer.toString(cl[i1].getBlue()));
    			b[i1].addTextListener(this);
    			jp[i1].add(b[i1]);
    		}
    							// 線の変更
    		if (wd > 0) {
    			Label lb1 = new Label("線の太さ:");
    			jp[n_g].add(lb1);
    			tx = new TextField(2);
    			tx.setBackground(Color.white);
    			tx.setText(Integer.toString((int)line_w));
    			jp[n_g].add(tx);
    		}
    
    		if (mk > 0) {
    			Label lb2 = new Label("マーク:");
    			jp[n-2].add(lb2);
    			CheckboxGroup cbg = new CheckboxGroup();
    			r1 = new Checkbox("付ける", cbg, false);
    			jp[n-2].add(r1);
    			r2 = new Checkbox("付けない", cbg, false);
    			jp[n-2].add(r2);
    			if (line_m)
    				r1.setState(true);
    			else
    				r2.setState(true);
    		}
    	}
    					// TextFieldの内容が変更されたときの処理
    	public void textValueChanged(TextEvent e)
    	{
    		for (int i1 = 0; i1 < n_g; i1++) {
    			if (e.getSource() == r[i1] || e.getSource() == g[i1] || e.getSource() == b[i1]) {
    				String str = r[i1].getText();
    				int rc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = g[i1].getText();
    				int gc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = b[i1].getText();
    				int bc = str.length()>0 ? Integer.parseInt(str) : 0;
    				rgb[i1].setBackground(new Color(rc, gc, bc));
    			}
    		}
    	}
    					// 値の設定
    	public void actionPerformed(ActionEvent e)
    	{
    							// 折れ線グラフ
    		if (e.getSource() == bt_dr) {
    			for (int i1 = 0; i1 < n_g; i1++) {
    				String str = r[i1].getText();
    				int rc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = g[i1].getText();
    				int gc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = b[i1].getText();
    				int bc = str.length()>0 ? Integer.parseInt(str) : 0;
    				dr.cl[i1] = new Color(rc, gc, bc);
    			}
    			dr.line_w = Integer.parseInt(tx.getText());
    			if (r1.getState())
    				dr.line_m = true;
    			else
    				dr.line_m = false;
    			dr.repaint();
    		}
    							// 積み上げ棒グラフ
    		else if (e.getSource() == bt_ds) {
    			for (int i1 = 0; i1 < ds.n_p; i1++) {
    				String str = r[i1].getText();
    				int rc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = g[i1].getText();
    				int gc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = b[i1].getText();
    				int bc = str.length()>0 ? Integer.parseInt(str) : 0;
    				ds.cl[i1] = new Color(rc, gc, bc);
    			}
    			ds.repaint();
    		}
    							// 棒グラフ
    		else if (e.getSource() == bt_db) {
    			for (int i1 = 0; i1 < db.n_g; i1++) {
    				String str = r[i1].getText();
    				int rc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = g[i1].getText();
    				int gc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = b[i1].getText();
    				int bc = str.length()>0 ? Integer.parseInt(str) : 0;
    				db.cl[i1] = new Color(rc, gc, bc);
    			}
    			db.repaint();
    		}
    							// ボード線図
    		else if (e.getSource() == bt_dd) {
    			for (int i1 = 0; i1 < n_g; i1++) {
    				String str = r[i1].getText();
    				int rc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = g[i1].getText();
    				int gc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = b[i1].getText();
    				int bc = str.length()>0 ? Integer.parseInt(str) : 0;
    				dd.cl[i1] = new Color(rc, gc, bc);
    			}
    			dd.line_w = Integer.parseInt(tx.getText());
    			dd.repaint();
    		}
    							// 円グラフ
    		else if (e.getSource() == bt_dp) {
    			for (int i1 = 0; i1 < dp.n_p; i1++) {
    				String str = r[i1].getText();
    				int rc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = g[i1].getText();
    				int gc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = b[i1].getText();
    				int bc = str.length()>0 ? Integer.parseInt(str) : 0;
    				dp.cl[i1] = new Color(rc, gc, bc);
    			}
    			dp.repaint();
    		}
    							// レーダーチャート
    		else if (e.getSource() == bt_da) {
    			for (int i1 = 0; i1 < n_g; i1++) {
    				String str = r[i1].getText();
    				int rc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = g[i1].getText();
    				int gc = str.length()>0 ? Integer.parseInt(str) : 0;
    				str = b[i1].getText();
    				int bc = str.length()>0 ? Integer.parseInt(str) : 0;
    				da.cl[i1] = new Color(rc, gc, bc);
    			}
    			da.line_w = Integer.parseInt(tx.getText());
    			if (r1.getState())
    				da.line_m = true;
    			else
    				da.line_m = false;
    			da.repaint();
    		}
    
    		setVisible(false);
    	}
    }
    			

  2. JavaScript

      ここをクリックすると,画面上で各グラフの表示例を見ることができます.

    test.html

    <!DOCTYPE HTML>
    <HTML>
    <HEAD>
    	<TITLE>グラフの表示例</TITLE>
    	<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
    	<META NAME=viewport CONTENT="width=device-width, initial-scale=1">
    	<LINK REL="stylesheet" TYPE="text/css" HREF="../../../master.css">
    	<SCRIPT TYPE="text/javascript" SRC="graph.js"></SCRIPT>
    	<SCRIPT TYPE="text/javascript">
    		function sel(kind)
    		{
    			let gp = "";
    					// 棒グラフ
    			if (kind == 0) {
    				gp = "0,棒グラフの例,x軸タイトル,y軸タイトル,6,自己啓発,目的意識,国際感覚,実行力,創造力,交渉力,5,非常に重視する,やや重視する,普通,あまり考慮しない,全く考慮しない,0.0,200.0,50.0,0,114,146,40,0,0,144,130,24,0,1,10,56,160,36,15,179,100,21,0,0,101,141,46,0,1,131,104,60,1,0,1,1";
    				str = "graph_js.htm?gp=" + gp;
    				open(str, "棒グラフ", "width=950, height=700");
    			}
    					// 折れ線グラフ(1)
    			else if (kind == 1) {
    				gp = "1,折れ線グラフの例(1),x軸タイトル,y軸タイトル,6,自己啓発,目的意識,国際感覚,実行力,創造力,交渉力,5,非常に重視する,やや重視する,普通,あまり考慮しない,全く考慮しない,0.0,200.0,50.0,0,114,146,40,0,0,144,130,24,0,1,10,56,160,36,15,179,100,21,0,0,101,141,46,0,1,131,104,60,1,0,1,1";
    				str = "graph_js.htm?gp=" + gp;
    				open(str, "折れ線グラフ(1)", "width=950, height=700");
    			}
    					// 折れ線グラフ(2)
    			else if (kind == 2) {
    				gp = "2,折れ線グラフの例(2),x軸タイトル,y軸タイトル,3,グラフ1,グラフ2,グラフ3,0.0,100.0,20.0,1,0.0,200.0,50.0,0,4,0,14,40,100,179,100,21,0,0,30,34,100,101,141,46,10,0,56,60,100,131,104,60,100,1,1";
    				str = "graph_js.htm?gp=" + gp;
    				open(str, "折れ線グラフ(2)", "width=950, height=700");
    			}
    					// 積み上げ棒グラフ
    			else if (kind == 3) {
    				gp = "3,積み上げ棒グラフの例(全体:300人),x軸タイトル,y軸タイトル,21,自己啓発,目的意識,国際感覚,実行力,創造力,交渉力,情報収集力,プレゼンテーション能力,積極性・自主性・チャレンジ精神,柔軟性・協調性,好奇心・探求心,持続力・忍耐力,責任感,明朗さ,真面目さ,基礎学力(数学・物理等),専門知識,専門技術,日本語(文章読解・文章作成),英語,コンピュータ・情報処理,5,非常に重視する,やや重視する,普通,あまり考慮しない,全く考慮しない,0.0,100.0,20.0,0";
    				data_y    = new Array();
    				data_y[0] = new Array();
    				data_y[0][0] = 114;
    				data_y[0][1] = 146;
    				data_y[0][2] = 40;
    				data_y[0][3] = 0;
    				data_y[0][4] = 0;
    				data_y[1] = new Array();
    				data_y[1][0] = 144;
    				data_y[1][1] = 130;
    				data_y[1][2] = 24;
    				data_y[1][3] = 0;
    				data_y[1][4] = 1;
    				data_y[2] = new Array();
    				data_y[2][0] = 10;
    				data_y[2][1] = 56;
    				data_y[2][2] = 160;
    				data_y[2][3] = 36;
    				data_y[2][4] = 15;
    				data_y[3] = new Array();
    				data_y[3][0] = 179;
    				data_y[3][1] = 100;
    				data_y[3][2] = 21;
    				data_y[3][3] = 0;
    				data_y[3][4] = 0;
    				data_y[4] = new Array();
    				data_y[4][0] = 101;
    				data_y[4][1] = 141;
    				data_y[4][2] = 46;
    				data_y[4][3] = 0;
    				data_y[4][4] = 1;
    				data_y[5] = new Array();
    				data_y[5][0] = 131;
    				data_y[5][1] = 104;
    				data_y[5][2] = 60;
    				data_y[5][3] = 1;
    				data_y[5][4] = 0;
    				data_y[6] = new Array();
    				data_y[6][0] = 55;
    				data_y[6][1] = 122;
    				data_y[6][2] = 107;
    				data_y[6][3] = 5;
    				data_y[6][4] = 1;
    				data_y[7] = new Array();
    				data_y[7][0] = 43;
    				data_y[7][1] = 95;
    				data_y[7][2] = 132;
    				data_y[7][3] = 13;
    				data_y[7][4] = 3;
    				data_y[8] = new Array();
    				data_y[8][0] = 215;
    				data_y[8][1] = 75;
    				data_y[8][2] = 11;
    				data_y[8][3] = 0;
    				data_y[8][4] = 0;
    				data_y[9] = new Array();
    				data_y[9][0] = 115;
    				data_y[9][1] = 142;
    				data_y[9][2] = 41;
    				data_y[9][3] = 0;
    				data_y[9][4] = 0;
    				data_y[10] = new Array();
    				data_y[10][0] = 87;
    				data_y[10][1] = 139;
    				data_y[10][2] = 61;
    				data_y[10][3] = 2;
    				data_y[10][4] = 1;
    				data_y[11] = new Array();
    				data_y[11][0] = 116;
    				data_y[11][1] = 141;
    				data_y[11][2] = 39;
    				data_y[11][3] = 0;
    				data_y[11][4] = 1;
    				data_y[12] = new Array();
    				data_y[12][0] = 172;
    				data_y[12][1] = 107;
    				data_y[12][2] = 23;
    				data_y[12][3] = 0;
    				data_y[12][4] = 1;
    				data_y[13] = new Array();
    				data_y[13][0] = 106;
    				data_y[13][1] = 122;
    				data_y[13][2] = 67;
    				data_y[13][3] = 2;
    				data_y[13][4] = 1;
    				data_y[14] = new Array();
    				data_y[14][0] = 115;
    				data_y[14][1] = 107;
    				data_y[14][2] = 68;
    				data_y[14][3] = 3;
    				data_y[14][4] = 1;
    				data_y[15] = new Array();
    				data_y[15][0] = 43;
    				data_y[15][1] = 116;
    				data_y[15][2] = 121;
    				data_y[15][3] = 12;
    				data_y[15][4] = 3;
    				data_y[16] = new Array();
    				data_y[16][0] = 44;
    				data_y[16][1] = 104;
    				data_y[16][2] = 124;
    				data_y[16][3] = 13;
    				data_y[16][4] = 7;
    				data_y[17] = new Array();
    				data_y[17][0] = 41;
    				data_y[17][1] = 99;
    				data_y[17][2] = 125;
    				data_y[17][3] = 16;
    				data_y[17][4] = 8;
    				data_y[18] = new Array();
    				data_y[18][0] = 32;
    				data_y[18][1] = 98;
    				data_y[18][2] = 150;
    				data_y[18][3] = 6;
    				data_y[18][4] = 3;
    				data_y[19] = new Array();
    				data_y[19][0] = 9;
    				data_y[19][1] = 48;
    				data_y[19][2] = 158;
    				data_y[19][3] = 50;
    				data_y[19][4] = 17;
    				data_y[20] = new Array();
    				data_y[20][0] = 46;
    				data_y[20][1] = 106;
    				data_y[20][2] = 128;
    				data_y[20][3] = 13;
    				data_y[20][4] = 1;
    				for (i1 = 0; i1 < 21; i1++) {
    					s = 0;
    					for (i2 = 0; i2 < 5; i2++)
    						s += data_y[i1][i2];
    					for (i2 = 0; i2 < 5; i2++) {
    						data_y[i1][i2] = data_y[i1][i2] / s * 100;
    						gp = gp + "," + data_y[i1][i2];
    					}
    				}
    				gp = gp + ",1,1";
    				str = "graph_js.htm?gp=" + gp;
    				open(str, "積み上げ棒グラフ", "width=950, height=700");
    			}
    					// 円グラフ
    			else if (kind == 4) {
    				gp = "4,円グラフの例(全体:277人),5,非常に重視する,やや重視する,普通,あまり考慮しない,全く考慮しない";
    				x = new Array();
    				x[0] = 10;
    				x[1] = 56;
    				x[2] = 160;
    				x[3] = 36;
    				x[4] = 15;
    				s    = 0;
    				for (i1 = 0; i1 < 5; i1++)
    					s += x[i1];
    				for (i1 = 0; i1 < 5; i1++) {
    					x[i1] = x[i1] / s * 100;
    					gp = gp + "," + x[i1];
    				}
    				gp = gp + ",1";
    				str = "graph_js.htm?gp=" + gp;
    				open(str, "円グラフ", "width=950, height=700");
    			}
    					// 散布図
    			else if (kind == 5) {
    				gp = "5,散布図の例,x軸タイトル,y軸タイトル,0.0,150.0,30.0,0,0.0,200.0,50.0,0,10,11,146,40,70,100,120,50,130,80,130,17,170,21,80,140,100,80,190,60,180,1";
    				str = "graph_js.htm?gp=" + gp;
    				open(str, "散布図", "width=950, height=700");
    			}
    					// レーダーチャート
    			else if (kind == 6) {
    				gp = "6,レーダーチャートの例,2,重要度,評価,21,自己啓発,目的意識,国際感覚,実行力,創造力,交渉力・調整力・コミュニケーション,情報収集力,プレゼンテーション能力,積極性・自主性・チャレンジ精神,柔軟性・協調性,好奇心・探求心,持続力・忍耐力,責任感,明朗さ,真面目さ,基礎学力(数学・物理等),専門知識,専門技術,日本語(文章読解・文章作成),英語,コンピュータ・情報処理,1.0,5.0,1.0,1,4.2,4.4,3.0,4.5,4.2,4.2,3.8,3.6,4.7,4.2,4.1,4.2,4.5,4.1,4.1,3.6,3.6,3.5,3.5,2.9,3.6,3.4,3.5,2.7,3.5,3.2,3.2,3.1,2.9,3.4,3.6,3.3,3.6,3.8,3.5,4.0,3.3,3.2,3.2,3.1,2.7,3.4,1,1";
    				str = "graph_js.htm?gp=" + gp;
    				open(str, "レーダーチャート", "width=950, height=700");
    			}
    					// ボード線図(片対数グラフ)
    			else {
    				gp = "7,ボード線図の例,角周波数,ゲイン(dB),2,一次遅れ要素,二次遅れ要素,0.01,100.0,1.0,2,-80.0,20.0,20.0,0,101,0.01,0.0109647819614318,0.0120226443461741,0.013182567385564,0.0144543977074592,0.0158489319246111,0.0173780082874937,0.0190546071796325,0.0208929613085404,0.0229086765276777,0.0251188643150958,0.0275422870333817,0.0301995172040202,0.0331131121482591,0.0363078054770102,0.0398107170553498,0.0436515832240167,0.0478630092322639,0.0524807460249773,0.0575439937337158,0.0630957344480195,0.0691830970918938,0.0758577575029186,0.0831763771102673,0.0912010839355912,0.1,0.109647819614318,0.120226443461741,0.131825673855641,0.144543977074593,0.158489319246111,0.173780082874938,0.190546071796325,0.208929613085404,0.229086765276778,0.251188643150959,0.275422870333817,0.301995172040202,0.331131121482592,0.363078054770102,0.398107170553498,0.436515832240167,0.47863009232264,0.524807460249774,0.575439937337159,0.630957344480195,0.691830970918939,0.758577575029186,0.831763771102674,0.912010839355913,1,1.09647819614318,1.20226443461741,1.31825673855641,1.44543977074593,1.58489319246111,1.73780082874938,1.90546071796325,2.08929613085404,2.29086765276778,2.51188643150958,2.75422870333817,3.01995172040202,3.31131121482592,3.63078054770102,3.98107170553498,4.36515832240167,4.7863009232264,5.24807460249774,5.75439937337159,6.30957344480195,6.91830970918939,7.58577575029186,8.31763771102674,9.12010839355913,10,10.9647819614318,12.0226443461741,13.1825673855641,14.4543977074593,15.8489319246112,17.3780082874938,19.0546071796325,20.8929613085404,22.9086765276778,25.1188643150959,27.5422870333818,30.1995172040203,33.1131121482592,36.3078054770103,39.8107170553499,43.6515832240168,47.8630092322641,52.4807460249775,57.543993733716,63.0957344480196,69.183097091894,75.8577575029188,83.1763771102676,91.2010839355915,100,-0.00043427276862636,-0.000522105424932322,-0.000627701152241214,-0.000754651740749838,-0.000907275005683991,-0.00109076142866441,-0.00131135036701045,-0.0015765417703246,-0.00189535052688523,-0.00227861197648364,-0.00273934881496565,-0.00329321162892171,-0.00395900769500453,-0.00475933552387765,-0.00572134599940977,-0.00687765494318666,-0.00826743661415132,-0.00993773312918616,-0.0119450211581656,-0.014357084593869,-0.017255250287929,-0.0207370534016865,-0.0249194093944646,-0.0299423809918071,-0.0359736402894658,-0.0432137378264255,-0.051902300972248,-0.0623252917208117,-0.0748234565761777,-0.0898020952083107,-0.10774225511957,-0.129213420154599,-0.154887692755856,-0.185555362732532,-0.222141596415848,-0.265723755961027,-0.317548557029209,-0.379047887154574,-0.451851641314966,-0.537795410636778,-0.6389203414338,-0.757462064101649,-0.895825422443528,-1.05654200302736,-1.2422083724146,-1.45540463109294,-1.69859540490393,-1.97401850619972,-2.2835697095824,-2.62869465226149,-3.01029995663982,-3.42869465226149,-3.8835697095824,-4.37401850619973,-4.89859540490394,-5.45540463109295,-6.04220837241461,-6.65654200302738,-7.29582542244354,-7.95746206410166,-8.63892034143381,-9.33779541063679,-10.0518516413149,-10.7790478871545,-11.5175485570292,-12.265723755961,-13.0221415964158,-13.7855553627325,-14.5548876927558,-15.3292134201546,-16.1077422551196,-16.8898020952083,-17.6748234565762,-18.4623252917208,-19.2519023009722,-20.0432137378264,-20.8359736402895,-21.6299423809918,-22.4249194093944,-23.2207370534017,-24.0172552502879,-24.8143570845939,-25.6119450211582,-26.4099377331292,-27.2082674366141,-28.0068776549432,-28.8057213459994,-29.6047593355239,-30.403959007695,-31.2032932116289,-32.002739348815,-32.8022786119765,-33.6018953505269,-34.4015765417703,-35.201311350367,-36.0010907614287,-36.8009072750057,-37.6007546517408,-38.4006277011522,-39.2005221054249,-40.0004342727686,0.01,0.0109647819614318,0.0120226443461741,0.013182567385564,0.0144543977074592,0.0158489319246111,0.0173780082874937,0.0190546071796325,0.0208929613085404,0.0229086765276777,0.0251188643150958,0.0275422870333817,0.0301995172040202,0.0331131121482591,0.0363078054770102,0.0398107170553498,0.0436515832240167,0.0478630092322639,0.0524807460249773,0.0575439937337158,0.0630957344480195,0.0691830970918938,0.0758577575029186,0.0831763771102673,0.0912010839355912,0.1,0.109647819614318,0.120226443461741,0.131825673855641,0.144543977074593,0.158489319246111,0.173780082874938,0.190546071796325,0.208929613085404,0.229086765276778,0.251188643150959,0.275422870333817,0.301995172040202,0.331131121482592,0.363078054770102,0.398107170553498,0.436515832240167,0.47863009232264,0.524807460249774,0.575439937337159,0.630957344480195,0.691830970918939,0.758577575029186,0.831763771102674,0.912010839355913,1,1.09647819614318,1.20226443461741,1.31825673855641,1.44543977074593,1.58489319246111,1.73780082874938,1.90546071796325,2.08929613085404,2.29086765276778,2.51188643150958,2.75422870333817,3.01995172040202,3.31131121482592,3.63078054770102,3.98107170553498,4.36515832240167,4.7863009232264,5.24807460249774,5.75439937337159,6.30957344480195,6.91830970918939,7.58577575029186,8.31763771102674,9.12010839355913,10,10.9647819614318,12.0226443461741,13.1825673855641,14.4543977074593,15.8489319246112,17.3780082874938,19.0546071796325,20.8929613085404,22.9086765276778,25.1188643150959,27.5422870333818,30.1995172040203,33.1131121482592,36.3078054770103,39.8107170553499,43.6515832240168,47.8630092322641,52.4807460249775,57.543993733716,63.0957344480196,69.183097091894,75.8577575029188,83.1763771102676,91.2010839355915,100,0.000760038415382399,0.000913772766359686,0.00109860460812431,0.00132082497033832,0.0015879978301257,0.00190921780497035,0.00229542006615489,0.00275975307888415,0.00331802694011069,0.00398925269639393,0.00479629117620189,0.00576663367903434,0.0069333414679863,0.00833617658612594,0.0100229632730993,0.0120512274603127,0.0144901717990999,0.0174230558361977,0.0209500658109257,0.0251917767617845,0.0302933320307221,0.0364294929122781,0.043810745501032,0.0526906945590592,0.0633750278465736,0.0762324020119698,0.0917076870782207,0.11033811653403,0.132773031837264,0.159798094398276,0.192365079368509,0.231628683657635,0.278992202428454,0.336164489672405,0.405231365272613,0.488745617523805,0.589841028229403,0.712377430460434,0.861125568145392,1.0420019107726,1.26236286023883,1.53136003903385,1.86032983314904,2.26310269847673,2.7558619659877,3.35544406114777,4.07285867859558,4.8930591948081,5.71985312756973,6.26638529740493,6.02059991327959,4.66638529740486,2.51985312756961,0.0930591948079767,-2.32714132140453,-4.64455593885234,-6.84413803401239,-8.93689730152335,-10.939670166851,-12.8686399609662,-14.7376371397612,-16.5579980892274,-18.3388744318546,-20.0876225695396,-21.8101589717706,-23.5112543824762,-25.1947686347274,-26.8638355103276,-28.5210077975716,-30.1683713163424,-31.8076349206315,-33.4402019056017,-35.0672269681628,-36.689661883466,-38.3082923129218,-39.9237675979881,-41.5366249721535,-43.147309305441,-44.756189254499,-46.3635705070877,-47.9697066679693,-49.5748082232382,-51.1790499341891,-52.7825769441638,-54.3855098282009,-55.9879487725397,-57.5899770367269,-59.1916638234139,-60.7930666585321,-62.394233366321,-63.9952037088238,-65.5960107473037,-67.1966819730599,-68.7972402469212,-70.3977045799339,-71.9980907821951,-73.5984120021699,-75.1986791750297,-76.7989013953919,-78.3990862272337,-79.9992399615847,1,1";
    				str = "graph_js.htm?gp=" + gp;
    				open(str, "ボード線図(片対数グラフ)", "width=950, height=700");
    			}
    		}
    	</SCRIPT>
    </HEAD>
    <BODY CLASS="white">
    	<H3 STYLE="text-align: center">表示するグラフを選択してください</H3>
    	<FORM>
    		<DIV STYLE="text-align: center">
    			<TABLE STYLE="text-align: left; margin-right: auto; margin-left: auto">
    				<TR>
    					<TD><INPUT TYPE="radio" NAME="g_type" onClick="sel(0)">棒グラフ</TD>
    					<TD><INPUT TYPE="radio" NAME="g_type" onClick="sel(1)">折れ線グラフ(1)</TD>
    				<TR>
    					<TD><INPUT TYPE="radio" NAME="g_type" onClick="sel(2)">折れ線グラフ(2)</TD>
    					<TD><INPUT TYPE="radio" NAME="g_type" onClick="sel(3)">積み上げ棒グラフ</TD>
    				</TR>
    				<TR>
    					<TD><INPUT TYPE="radio" NAME="g_type" onClick="sel(4)">円グラフ</TD>
    					<TD><INPUT TYPE="radio" NAME="g_type" onClick="sel(5)">散布図</TD>
    				</TR>
    				<TR>
    					<TD><INPUT TYPE="radio" NAME="g_type" onClick="sel(6)">レーダーチャート</TD>
    					<TD><INPUT TYPE="radio" NAME="g_type" onClick="sel(7)">ボード線図(片対数グラフ)</TD>
    				</TR>
    			</TABLE>
    		</DIV>
    	</FORM>
    </BODY>
    </HTML>
    			

    graph_js.js

    <!DOCTYPE HTML>
    <HTML>
    <HEAD>
    	<TITLE>グラフの表示</TITLE>
    	<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
    	<META NAME=viewport CONTENT="width=device-width, initial-scale=1">
    	<LINK REL="stylesheet" TYPE="text/css" HREF="../../../master.css">
    	<SCRIPT TYPE="text/javascript" SRC="graph.js"></SCRIPT>
    	<SCRIPT TYPE="text/javascript">
    		function GetParameter()
    		{
    			let result = new Array();
    			if(1 < window.location.search.length) {
    							// 最初の1文字 (?記号) を除いた文字列を取得する
    				let str = window.location.search.substring(1);
    							// 区切り記号 (&) で文字列を配列に分割する
    				let param = str.split('&');
    				for(let i1 = 0; i1 < param.length; i1++ ) {
    							// パラメータ名とパラメータ値に分割する
    					let element = param[i1].split('=');
    					let Name = decodeURIComponent(element[0]);
    					let Value = decodeURIComponent(element[1]);
    							// パラメータ名をキーとして連想配列に追加する
    					result[Name] = Value;
    				}
    			}
    			return result;
    		}
    	</SCRIPT>
    </HEAD>
    <BODY CLASS="white" STYLE="text-align: center">
    	<DIV ID="cl_line" STYLE="text-align: center; display: none">
    		<FORM>
    			<DIV ID="c0">
    				<INPUT ID="rgb0" TYPE="text" SIZE="3" STYLE="font-size: 90%"> 
    				赤<INPUT ID="r0" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(0)"> 
    				緑<INPUT ID="g0" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(0)"> 
    				青<INPUT ID="b0" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(0)">
    			</DIV>
    			<DIV ID="c1">
    				<INPUT ID="rgb1" TYPE="text" SIZE="3" STYLE="font-size: 90%"> 
    				赤<INPUT ID="r1" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(1)"> 
    				緑<INPUT ID="g1" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(1)"> 
    				青<INPUT ID="b1" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(1)">
    			</DIV>
    			<DIV ID="c2">
    				<INPUT ID="rgb2" TYPE="text" SIZE="3" STYLE="font-size: 90%"> 
    				赤<INPUT ID="r2" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(2)"> 
    				緑<INPUT ID="g2" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(2)"> 
    				青<INPUT ID="b2" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(2)">
    			</DIV>
    			<DIV ID="c3">
    				<INPUT ID="rgb3" TYPE="text" SIZE="3" STYLE="font-size: 90%"> 
    				赤<INPUT ID="r3" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(3)"> 
    				緑<INPUT ID="g3" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(3)"> 
    				青<INPUT ID="b3" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(3)">
    			</DIV>
    			<DIV ID="c4">
    				<INPUT ID="rgb4" TYPE="text" SIZE="3" STYLE="font-size: 90%"> 
    				赤<INPUT ID="r4" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(4)"> 
    				緑<INPUT ID="g4" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(4)"> 
    				青<INPUT ID="b4" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(4)">
    			</DIV>
    			<DIV ID="c5">
    				<INPUT ID="rgb5" TYPE="text" SIZE="3" STYLE="font-size: 90%"> 
    				赤<INPUT ID="r5" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(5)"> 
    				緑<INPUT ID="g5" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(5)"> 
    				青<INPUT ID="b5" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(5)">
    			</DIV>
    			<DIV ID="c6">
    				<INPUT ID="rgb6" TYPE="text" SIZE="3" STYLE="font-size: 90%"> 
    				赤<INPUT ID="r6" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(6)"> 
    				緑<INPUT ID="g6" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(6)"> 
    				青<INPUT ID="b6" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(6)">
    			</DIV>
    			<DIV ID="c7">
    				<INPUT ID="rgb7" TYPE="text" SIZE="3" STYLE="font-size: 90%"> 
    				赤<INPUT ID="r7" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(7)"> 
    				緑<INPUT ID="g7" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(7)"> 
    				青<INPUT ID="b7" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(7)">
    			</DIV>
    			<DIV ID="c8">
    				<INPUT ID="rgb8" TYPE="text" SIZE="3" STYLE="font-size: 90%"> 
    				赤<INPUT ID="r8" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(8)"> 
    				緑<INPUT ID="g8" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(8)"> 
    				青<INPUT ID="b8" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(8)">
    			</DIV>
    			<DIV ID="c9">
    				<INPUT ID="rgb9" TYPE="text" SIZE="3" STYLE="font-size: 90%"> 
    				赤<INPUT ID="r9" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(9)"> 
    				緑<INPUT ID="g9" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(9)"> 
    				青<INPUT ID="b9" TYPE="text" SIZE="1" STYLE="font-size: 90%" onblur="c_change(9)">
    			</DIV>
    			<DIV ID="line_m">
    				マーク:<INPUT ID="l_m1" TYPE="radio" NAME="mark" STYLE="font-size: 90%" CHECKED>付ける 
    				<INPUT ID="l_m2" TYPE="radio" NAME="mark" STYLE="font-size: 90%">付けない
    			</DIV>
    			<DIV ID="line_w">
    				線の太さ:<INPUT ID="l_w" TYPE="text" SIZE="3" STYLE="font-size: 90%" VALUE="2">
    			</DIV>
    			<DIV>
    				<SPAN STYLE="background-color: pink; font-size: 100%" onClick="D_Change()">OK</SPAN>
    			</DIV>
    		</FORM>
    	</DIV>
    	<BR>
    	<DIV STYLE="text-align: center">
    		<CANVAS ID="canvas_e" STYLE="background-color: #eeffee;" WIDTH="900" HEIGHT="600" onClick="Click(event)"></CANVAS>
    	</DIV>
    	<SCRIPT TYPE="text/javascript">
    		let result = GetParameter();
    		graph(result['gp']);
    	</SCRIPT>
    </BODY>
    </HTML>
    			

    graph.js

    canvas  = null;
    ctx     = null;
    title   = null;   // グラフタイトル, x軸タイトル, y軸タイトル
    n_g     = 0;   // グラフの数
    g_title = null;   // 各グラフのタイトル(凡例)
    n_p     = 0;   // データの数
    x_title = null;   // x軸への表示内容
    x_scale = null;   // x軸の最小値, y軸の最大値, y軸の刻み幅
    xx_scale = null;   // x_scale の対数値
    place_x = 0;   // x軸の小数点以下桁数
    y_scale = null;   // y軸の最小値, y軸の最大値, y軸の刻み幅
    place_y = 0;   // y軸の小数点以下桁数
    data_x  = null;   // データ(x軸,n_g×n_p個)
    data_y  = null;   // データ(y軸,n_g×n_p個)
    data_xx = null;   // data_x の対数値
    d_t     = true;   // グラフタイトル表示の有無
    d_g     = true;   // 凡例表示の有無
    kind    = 0;   // グラフの種類
    ver     = true;   // 縦か横か( true が縦)
    cx      = 0;   // 表示切り替えボタンのx座標
    cy      = 0;   // 表示切り替えボタンのy座標
    cw      = 0;   // 表示切り替えボタンの幅
    ch      = 0;   // 表示切り替えボタンの高さ
    x_base  = 0;   // キャンバスの左上のx座標
    y_base  = 0;   // キャンバスの左上のy座標
    cl      = new Array(10);   // グラフの色
    cl[0]   = "rgb(0, 0, 0)";
    cl[1]   = "rgb(255, 0, 255)";
    cl[2]   = "rgb(0, 0, 255)";
    cl[3]   = "rgb(128, 0, 128)";
    cl[4]   = "rgb(0, 255, 255)";
    cl[5]   = "rgb(0, 128, 128)";
    cl[6]   = "rgb(0, 128, 0)";
    cl[7]   = "rgb(192, 192, 192)";
    cl[8]   = "rgb(255, 0, 0)";
    cl[9]   = "rgb(128, 0, 0)";
    clr = new Array (0, 255, 0, 128, 0, 0, 0, 192, 255, 128);
    clg = new Array (0, 0, 0, 0, 255, 128, 128, 192, 0, 0);
    clb = new Array (0, 255, 255, 128, 255, 128, 0, 192, 0, 0);
    change = "";   // 表示切り替えボタン
    line_w = 2;   // 折れ線グラフ等の線の太さ
    line_m = true;   // 折れ線グラフ等にマークを付けるか否か
    gpp = null;
    
    /****************************/
    /* グラフの描画             */
    /*      coded by Y.Suganuma */
    /****************************/
    function graph(gp)
    {
    	canvas        = document.getElementById('canvas_e');
    	canvas.width  = 900;   // キャンバス要素の幅
    	canvas.height = 600;   // キャンバス要素の高さ
    	ctx           = canvas.getContext('2d');   // キャンバスからコンテキストを取得
    	x_base        = canvas.offsetLeft;   // キャンバスの左上のx座標
    	y_base        = canvas.offsetTop;   // キャンバスの左上のy座標
    	gpp           = gp;
    					// データの分離とグラフの選択
    	let a = gp.split(",");
    	kind = parseInt(a[0]);   // グラフの種類
    	let k = 1;
    							//
    							// 棒グラフ
    							//
    	if (kind == 0) {
    		change = "縦 色";   // 表示切り替えボタン
    		title = new Array(3);   // グラフタイトル, x軸タイトル, y軸タイトル
    		for (let i1 = 0; i1 < 3; i1++) {
    			title[i1] = a[k];
    			k++;
    		}
    		n_g = parseInt(a[k]);   // グラフの数
    		g_title = new Array(n_g);   // 各グラフのタイトル(凡例)
    		k++;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			g_title[i1] = a[k];
    			k++;
    		}
    		n_p = parseInt(a[k]);   // データの数
    		x_title = new Array(n_p);   // x軸への表示内容
    		k++;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			x_title[i1] = a[k];
    			k++;
    		}
    		y_scale = new Array(3);   // y軸の最小値, y軸の最大値, y軸の刻み幅
    		for (let i1 = 0; i1 < 3; i1++) {
    			y_scale[i1] = parseFloat(a[k]);
    			k++;
    		}
    		place_y = parseInt(a[k]);   // y軸の小数点以下桁数
    		k++;
    		data_y = new Array(n_g);   // データ(n_g×n_p個)
    		for (let i1 = 0; i1 < n_g; i1++) {
    			data_y[i1] = new Array(n_p);
    			for (let i2 = 0; i2 < n_p; i2++) {
    				data_y[i1][i2] = parseFloat(a[k]);
    				k++;
    			}
    		}
    		if (parseInt(a[k]) == 0)   // グラフタイトルの表示
    			d_t = false;
    		if (parseInt(a[k+1]) == 0)   // 凡例の表示
    			d_g = false;
    		set();
    		BarGraph();
    	}
    							//
    							// 折れ線グラフ(1)
    							//
    	else if (kind == 1) {
    		change = "縦 色";   // 表示切り替えボタン
    		title = new Array(3);   // グラフタイトル, x軸タイトル, y軸タイトル
    		for (let i1 = 0; i1 < 3; i1++) {
    			title[i1] = a[k];
    			k++;
    		}
    		n_g = parseInt(a[k]);   // グラフの数
    		g_title = new Array(n_g);   // 各グラフのタイトル(凡例)
    		k++;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			g_title[i1] = a[k];
    			k++;
    		}
    		n_p = parseInt(a[k]);   // データの数
    		x_title = new Array(n_p);   // x軸への表示内容
    		k++;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			x_title[i1] = a[k];
    			k++;
    		}
    		y_scale = new Array(3);   // y軸の最小値, y軸の最大値, y軸の刻み幅
    		for (let i1 = 0; i1 < 3; i1++) {
    			y_scale[i1] = parseFloat(a[k]);
    			k++;
    		}
    		place_y = parseInt(a[k]);   // y軸の小数点以下桁数
    		k++;
    		data_y = new Array(n_g);   // データ(n_g×n_p個)
    		for (let i1 = 0; i1 < n_g; i1++) {
    			data_y[i1] = new Array(n_p);
    			for (let i2 = 0; i2 < n_p; i2++) {
    				data_y[i1][i2] = parseFloat(a[k]);
    				k++;
    			}
    		}
    		if (parseInt(a[k]) == 0)   // グラフタイトルの表示
    			d_t = false;
    		if (parseInt(a[k+1]) == 0)   // 凡例の表示
    			d_g = false;
    		set();
    		LineGraph1();
    	}
    							//
    							// 折れ線グラフ(2)
    							//
    	else if (kind == 2) {
    		change = "縦 色";   // 表示切り替えボタン
    		title = new Array(3);   // グラフタイトル, x軸タイトル, y軸タイトル
    		for (let i1 = 0; i1 < 3; i1++) {
    			title[i1] = a[k];
    			k++;
    		}
    		n_g = parseInt(a[k]);   // グラフの数
    		g_title = new Array(n_g);   // 各グラフのタイトル(凡例)
    		k++;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			g_title[i1] = a[k];
    			k++;
    		}
    		x_scale = new Array(3);   // x軸の最小値, x軸の最大値, x軸の刻み幅
    		for (let i1 = 0; i1 < 3; i1++) {
    			x_scale[i1] = parseFloat(a[k]);
    			k++;
    		}
    		place_x = parseInt(a[k]);   // x軸の小数点以下桁数
    		k++;
    		y_scale = new Array(3);   // y軸の最小値, y軸の最大値, y軸の刻み幅
    		for (let i1 = 0; i1 < 3; i1++) {
    			y_scale[i1] = parseFloat(a[k]);
    			k++;
    		}
    		place_y = parseInt(a[k]);   // y軸の小数点以下桁数
    		k++;
    		n_p = parseInt(a[k]);   // データの数
    		k++;
    		data_x = new Array(n_g);   // x軸のデータ(n_g×n_p個)
    		data_y = new Array(n_g);   // y軸のデータ(n_g×n_p個)
    		for (let i1 = 0; i1 < n_g; i1++) {
    			data_x[i1] = new Array(n_p);
    			for (let i2 = 0; i2 < n_p; i2++) {
    				data_x[i1][i2] = parseFloat(a[k]);
    				k++;
    			}
    			data_y[i1] = new Array(n_p);
    			for (let i2 = 0; i2 < n_p; i2++) {
    				data_y[i1][i2] = parseFloat(a[k]);
    				k++;
    			}
    		}
    		if (parseInt(a[k]) == 0)   // グラフタイトルの表示
    			d_t = false;
    		if (parseInt(a[k+1]) == 0)   // 凡例の表示
    			d_g = false;
    		set();
    		LineGraph2();
    	}
    							//
    							// 積み上げ棒グラフ
    							//
    	else if (kind == 3) {
    		change = "縦 色";   // 表示切り替えボタン
    		title = new Array(3);   // グラフタイトル, x軸タイトル, y軸タイトル
    		for (let i1 = 0; i1 < 3; i1++) {
    			title[i1] = a[k];
    			k++;
    		}
    		n_g = parseInt(a[k]);   // グラフの数
    		g_title = new Array(n_g);   // 各グラフのタイトル(凡例)
    		k++;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			g_title[i1] = a[k];
    			k++;
    		}
    		n_p = parseInt(a[k]);   // データの数
    		x_title = new Array(n_p);   // x軸への表示内容(凡例)
    		k++;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			x_title[i1] = a[k];
    			k++;
    		}
    		y_scale = new Array(3);   // y軸の最小値, y軸の最大値, y軸の刻み幅
    		for (let i1 = 0; i1 < 3; i1++) {
    			y_scale[i1] = parseFloat(a[k]);
    			k++;
    		}
    		place_y = parseInt(a[k]);   // y軸の小数点以下桁数
    		k++;
    		data_y = new Array(n_g);   // データ(n_g×n_p個)
    		for (let i1 = 0; i1 < n_g; i1++) {
    			data_y[i1] = new Array(n_p);
    			for (let i2 = 0; i2 < n_p; i2++) {
    				data_y[i1][i2] = parseFloat(a[k]);
    				k++;
    			}
    		}
    		if (parseInt(a[k]) == 0)   // グラフタイトルの表示
    			d_t = false;
    		if (parseInt(a[k+1]) == 0)   // 凡例の表示
    			d_g = false;
    		set();
    		StackGraph();
    	}
    							//
    							// 円グラフ
    							//
    	else if (kind == 4) {
    		change = " 色 ";   // 表示切り替えボタン
    		title = new Array();   // グラフタイトル
    		title[0] = a[k];
    		k++;
    		n_p = parseInt(a[k]);   // データの数
    		x_title = new Array(n_p);   // 凡例
    		k++;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			x_title[i1] = a[k];
    			k++;
    		}
    		data_y = new Array();   // データ(n_p個)
    		for (let i1 = 0; i1 < n_p; i1++) {
    			data_y[i1] = parseFloat(a[k]);
    			k++;
    		}
    		if (parseInt(a[k]) == 0)   // グラフタイトルの表示
    			d_t = false;
    		set();
    		PieGraph();
    	}
    							//
    							// 散布図
    							//
    	else if (kind == 5) {
    		title = new Array(3);   // グラフタイトル, x軸タイトル, y軸タイトル
    		for (let i1 = 0; i1 < 3; i1++) {
    			title[i1] = a[k];
    			k++;
    		}
    		x_scale = new Array(3);   // x軸の最小値, x軸の最大値, x軸の刻み幅
    		for (let i1 = 0; i1 < 3; i1++) {
    			x_scale[i1] = parseFloat(a[k]);
    			k++;
    		}
    		place_x = parseInt(a[k]);   // x軸の小数点以下桁数
    		k++;
    		y_scale = new Array(3);   // y軸の最小値, y軸の最大値, y軸の刻み幅
    		for (let i1 = 0; i1 < 3; i1++) {
    			y_scale[i1] = parseFloat(a[k]);
    			k++;
    		}
    		place_y = parseInt(a[k]);   // y軸の小数点以下桁数
    		k++;
    		n_p = parseInt(a[k]);   // データの数
    		k++;
    		data_y = new Array(2);   // データ(2×n_p個)
    		for (let i1 = 0; i1 < 2; i1++) {
    			data_y[i1] = new Array(n_p);
    			for (let i2 = 0; i2 < n_p; i2++) {
    				data_y[i1][i2] = parseFloat(a[k]);
    				k++;
    			}
    		}
    		if (parseInt(a[k]) == 0)   // グラフタイトルの表示
    			d_t = false;
    		ScatterDiagram();
    	}
    							//
    							// レーダーチャート
    							//
    	else if (kind == 6) {
    		change = " 色 ";   // 表示切り替えボタン
    		title    = new Array(1);   // グラフタイトル
    		title[0] = a[k];
    		k++;
    		n_g = parseInt(a[k]);   // グラフの数
    		g_title = new Array(n_g);   // 各グラフのタイトル(凡例)
    		k++;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			g_title[i1] = a[k];
    			k++;
    		}
    		n_p = parseInt(a[k]);   // データの数
    		x_title = new Array(n_p);   // x軸への表示内容
    		k++;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			x_title[i1] = a[k];
    			k++;
    		}
    		y_scale = new Array(3);   // y軸の最小値, y軸の最大値, y軸の刻み幅
    		for (let i1 = 0; i1 < 3; i1++) {
    			y_scale[i1] = parseFloat(a[k]);
    			k++;
    		}
    		place_y = parseInt(a[k]);   // y軸の小数点以下桁数
    		k++;
    		data_y = new Array(n_g);   // データ(n_g×n_p個)
    		for (let i1 = 0; i1 < n_g; i1++) {
    			data_y[i1] = new Array(n_p);
    			for (let i2 = 0; i2 < n_p; i2++) {
    				data_y[i1][i2] = parseFloat(a[k]);
    				k++;
    			}
    		}
    		if (parseInt(a[k]) == 0)   // グラフタイトルの表示
    			d_t = false;
    		if (parseInt(a[k+1]) == 0)   // 凡例の表示
    			d_g = false;
    		set();
    		RadarChart();
    	}
    							//
    							// ボード線図(片対数グラフ)
    							//
    	else {
    		change = " 色 ";   // 表示切り替えボタン
    		title = new Array(3);   // グラフタイトル, x軸タイトル, y軸タイトル
    		for (let i1 = 0; i1 < 3; i1++) {
    			title[i1] = a[k];
    			k++;
    		}
    		n_g = parseInt(a[k]);   // グラフの数
    		g_title = new Array(n_g);   // 各グラフのタイトル(凡例)
    		k++;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			g_title[i1] = a[k];
    			k++;
    		}
    		x_scale = new Array(3);   // x軸の最小値, x軸の最大値, x軸の刻み幅
    		for (let i1 = 0; i1 < 3; i1++) {
    			x_scale[i1] = parseFloat(a[k]);
    			k++;
    		}
    		place_x = parseInt(a[k]);   // x軸の小数点以下桁数
    		k++;
    		y_scale = new Array(3);   // y軸の最小値, y軸の最大値, y軸の刻み幅
    		for (let i1 = 0; i1 < 3; i1++) {
    			y_scale[i1] = parseFloat(a[k]);
    			k++;
    		}
    		place_y = parseInt(a[k]);   // y軸の小数点以下桁数
    		k++;
    		n_p = parseInt(a[k]);   // データの数
    		k++;
    		data_x = new Array(n_g);   // x軸のデータ(n_g×n_p個)
    		data_y = new Array(n_g);   // y軸のデータ(n_g×n_p個)
    		for (let i1 = 0; i1 < n_g; i1++) {
    			data_x[i1] = new Array(n_p);
    			for (let i2 = 0; i2 < n_p; i2++) {
    				data_x[i1][i2] = parseFloat(a[k]);
    				k++;
    			}
    			data_y[i1] = new Array(n_p);
    			for (let i2 = 0; i2 < n_p; i2++) {
    				data_y[i1][i2] = parseFloat(a[k]);
    				k++;
    			}
    		}
    		if (parseInt(a[k]) == 0)   // グラフタイトルの表示
    			d_t = false;
    		if (parseInt(a[k+1]) == 0)   // 凡例の表示
    			d_g = false;
    		set();
    		Bode();
    	}
    }
    
    /****************************/
    /* 表示変更エリアの設定     */
    /*      coded by Y.Suganuma */
    /****************************/
    function set()
    {
    	let rgb ="rgb";
    	let r ="r";
    	let g ="g";
    	let b ="b";
    	for (let i1 = 0; i1 < 10; i1++) {
    		let rgb1 = rgb + i1;
    		document.getElementById(rgb1).style.backgroundColor = cl[i1];
    		let r1 = r + i1;
    		document.getElementById(r1).value = clr[i1];
    		let g1 = g + i1;
    		document.getElementById(g1).value = clg[i1];
    		let b1 = b + i1;
    		document.getElementById(b1).value = clb[i1];
    	}
    }
    
    /****************************/
    /* 棒グラフの描画           */
    /*      coded by Y.Suganuma */
    /****************************/
    function BarGraph()
    {
    	let tx = new Array();
    					//
    					// 描画領域の設定
    					//
    	ctx.fillStyle  = 'rgb(255, 255, 255)';
    	ctx.fillRect(10, 10, canvas.width-20, canvas.height-20);
    	let x_l = 15;
    	let x_r = canvas.width - 15;
    	let y_u = 15;
    	let y_d = canvas.height - 15;
    					//
    					// グラフタイトルの表示
    					//
    	let r      = 0.05;   // タイトル領域の割合
    	let f_size = ((y_d - y_u) < (x_r - x_l)) ? Math.floor((y_d - y_u) * r) : Math.floor((x_r - x_l) * r);
    	if (f_size < 5)
    		f_size = 5;
    	if (d_t) {
    		ctx.fillStyle  = 'rgb(0, 0, 0)';
    		ctx.font = f_size + "px 'MS ゴシック'";
    		let met = ctx.measureText(title[0]);
    		let px  = (x_l + x_r) / 2 - met.width / 2;
    		let py  = y_d;
    		ctx.fillText(title[0], px, py);
    		y_d -= f_size;
    	}
    					//
    					// 表示切り替えボタンの設置
    					//
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font = f_size + "px 'MS ゴシック'";
    	let met = ctx.measureText(change);
    	cx = x_r - met.width - 5;
    	cy = y_u;
    	cw = met.width + 5;
    	ch = f_size + 5;
    	ctx.fillStyle  = 'rgb(255, 215, 0)';
    	ctx.fillRect(cx, cy, cw, ch);
    	ctx.fillStyle  = 'rgb(0, 0, 0)';
    	let px = cx + 2;
    	let py = cy + f_size;
    	ctx.fillText(change, px, py);
    					//
    					// 凡例の表示
    					//
    	if (d_g) {
    		let han = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let met = ctx.measureText(g_title[i1]);
    			if (met.width > han)
    				han = met.width;
    		}
    		han += 15;
    		r    = 0.2;   // 凡例領域の割合
    		let k1 = Math.floor((x_r - x_l) * r);
    		if (han > k1)
    			han = k1;
    		let kx = x_r - han;
    		let ky = y_u + 2 * f_size;
    		let k  = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			ctx.fillStyle  = cl[k];
    			ctx.fillRect(kx, ky-1, 10, 7);
    			ctx.fillStyle  = 'rgb(0, 0, 0)';
    			ctx.fillText(g_title[i1], kx+15, ky+2*f_size/5);
    			k++;
    			if (k > 9)
    				k = 0;
    			ky += (f_size + 5);
    		}
    		x_r -= (han + 10);
    	}
    	else
    		x_r -= Math.floor(0.03 * (x_r - x_l));
    					//
    					// x軸及びy軸のタイトルの表示
    					//
    							// 縦表示
    	ctx.fillStyle = 'rgb(0, 0, 0)';
    	if (ver) {
    		if (title[1].length > 0 && title[1] != "-") {
    			let met = ctx.measureText(title[1]);
    			let px  = (x_l + x_r) / 2 - met.width / 2;
    			let py  = y_d - 5;
    			ctx.fillText(title[1], px, py);
    			y_d -= (f_size + 5);
    		}
    		if (title[2].length > 0 && title[2] != "-") {
    			let met = ctx.measureText(title[2]);
    			let px  = x_l;
    			let py  = y_u + 4 * f_size / 5;
    			ctx.fillText(title[2], px, py);
    			y_u += 4 * f_size / 5;
    		}
    	}
    							// 横表示
    	else {
    		if (title[2].length > 0 && title[2] != "-") {
    			let met = ctx.measureText(title[2]);
    			let px  = (x_l + x_r) / 2 - met.width / 2;
    			let py  = y_d - 5;
    			ctx.fillText(title[2], px, py);
    			y_d -= (f_size + 5);
    		}
    		if (title[1].length > 0 && title[1].localeCompare("-") != 0) {
    			let met = ctx.measureText(title[1]);
    			let px  = x_l;
    			let py  = y_u + 4 * f_size / 5;
    			ctx.fillText(title[1], px, py);
    			y_u += 4 * f_size / 5;
    		}
    	}
    	y_u += 10;
    					//
    					// x軸,y軸,及び,各軸の目盛り
    					//
    	ctx.lineWidth   = 1;
    	ctx.strokeStyle = "rgb(0, 0, 0)";
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font  = f_size + "px 'MS 明朝'";
    	y_d      -= (f_size + 5);
    							// 縦表示
    	if (ver) {
    									// y軸
    		let y1  = y_scale[0];
    		let k   = Math.floor((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		let len = 0;
    		let b   = Math.pow(10, place_y);
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let yy = Math.round(y1 * b).toString();
    			if (place_y == 0)
    				tx[i1] = yy;
    			else {
    				if (yy.length < place_y+1) {
    					let n = place_y + 1 - yy.length;
    					for (let i2 = 0; i2 < n; i2++)
    						yy = "0" + yy;
    				}
    				tx[i1] = yy.substr(0,yy.length-place_y) + "." + yy.substr(yy.length-place_y,place_y);
    			}
    			let met = ctx.measureText(tx[i1]);
    			if (met.width > len)
    				len = met.width;
    			y1 += y_scale[2];
    		}
    		ctx.moveTo(x_l+len+10, y_u);
    		ctx.lineTo(x_l+len+10, y_d);
    		ctx.moveTo(x_r, y_u);
    		ctx.lineTo(x_r, y_d);
    		y1 = y_scale[0];
    		let x1 = y_d;
    		let sp = (y_d - y_u) / k;
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let ky  = Math.floor(Math.round(x1));
    			let met = ctx.measureText(tx[i1]);
    			let k1  = met.width;
    			let px  = x_l + len - k1;
    			let py  = ky + 2 * f_size / 5;
    			ctx.fillText(tx[i1], px, py);
    			ctx.moveTo(x_l+len+10, ky);
    			ctx.lineTo(x_r, ky);
    			y1 += y_scale[2];
    			x1 -= sp;
    		}
    		x_l += (len + 10);
    									// x軸
    		sp  = (x_r - x_l) / n_p;
    		x1  = x_l + sp / 2.0;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			let kx  = Math.floor(Math.round(x1));
    			let met = ctx.measureText(x_title[i1]);
    			let k1  = met.width;
    			let px  = kx - k1 / 2;
    			let py  = y_d + 11 * f_size / 10;
    			ctx.fillText(x_title[i1], px, py);
    			ctx.moveTo(kx, y_d);
    			ctx.lineTo(kx, y_d-5);
    			x1 += sp;
    		}
    	}
    							// 横表示
    	else {
    									// y軸
    		let len = 0;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			let met = ctx.measureText(x_title[i1]);
    			if (met.width > len)
    				len = met.width;
    		}
    		ctx.moveTo(x_l+len+5, y_u);
    		ctx.lineTo(x_l+len+5, y_d);
    		ctx.moveTo(x_r, y_u);
    		ctx.lineTo(x_r, y_d);
    		let sp = (y_d - y_u) / n_p;
    		let y1 = y_d - sp / 2.0;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			let ky  = Math.floor(Math.round(y1));
    			let met = ctx.measureText(x_title[n_p-1-i1]);
    			let k1  = met.width;
    			let px  = x_l + len - k1;
    			let py  = ky + 2 * f_size / 5;
    			ctx.fillText(x_title[n_p-1-i1], px, py);
    			ctx.moveTo(x_l+len+5, ky);
    			ctx.lineTo(x_l+len+10, ky);
    			y1 -= sp;
    		}
    		ctx.moveTo(x_l+len+5, y_u);
    		ctx.lineTo(x_r, y_u);
    		ctx.moveTo(x_l+len+5, y_d);
    		ctx.lineTo(x_r, y_d);
    		x_l += (len + 5);
    									// x軸
    		let k  = Math.floor((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		let x1 = y_scale[0];
    		y1 = x_l;
    		sp = (x_r - x_l) / k;
    		let b = Math.pow(10, place_y);
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let kx = Math.floor(Math.round(y1));
    			let yy = Math.round(x1 * b).toString();
    			let st;
    			if (place_y == 0)
    				st = yy;
    			else {
    				if (yy.length < place_y+1) {
    					n = place_y + 1 - yy.length;
    					for (i2 = 0; i2 < n; i2++)
    						yy = "0" + yy;
    				}
    				st = yy.substr(0,yy.length-place_y) + "." + yy.substr(yy.length-place_y,place_y);
    			}
    			let met = ctx.measureText(st);
    			let k1  = met.width;
    			let px  = kx - k1 / 2;
    			let py  = y_d + f_size;
    			ctx.fillText(st, px, py);
    			if (i1 < k) {
    				ctx.moveTo(kx, y_d);
    				ctx.lineTo(kx, y_u);
    			}
    			x1 += y_scale[2];
    			y1 += sp;
    		}
    	}
    	ctx.stroke();
    					//
    					// グラフの表示
    					//
    							// 縦表示
    	if (ver) {
    		let g_w = Math.floor(0.8 * (x_r - x_l) / (n_g * n_p));
    		let sp  = (x_r - x_l) / n_p;
    		let x1  = x_l + sp / 2.0;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			let kx = Math.floor(Math.round(x1));
    			let k1 = 0;
    			let k2 = kx - n_g * g_w / 2;
    			for (let i2 = 0; i2 < n_g; i2++) {
    				let ky = y_d - Math.floor((y_d - y_u) * (data_y[i2][i1] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    				ctx.fillStyle = cl[k1];
    				ctx.fillRect(k2, ky, g_w, y_d-ky);
    				k2 += g_w;
    				k1++;
    				if (k1 > 9)
    					k1 = 0;
    			}
    			x1 += sp;
    		}
    	}
    							// 横表示
    	else {
    		let g_w = Math.floor(0.8 * (y_d - y_u) / (n_g * n_p));
    		let sp  = (y_d - y_u) / n_p;
    		let y1  = y_d - sp / 2.0;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			let ky = Math.floor(Math.round(y1));
    			let k1 = 0;
    			let k2 = ky - n_g * g_w / 2;
    			for (let i2 = 0; i2 < n_g; i2++) {
    				let kx = Math.floor((x_r - x_l) * (data_y[i2][n_p-1-i1] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    				ctx.fillStyle = cl[k1];
    				ctx.fillRect(x_l, k2, kx, g_w);
    				k2 += g_w;
    				k1++;
    				if (k1 > 9)
    					k1 = 0;
    			}
    			y1 -= sp;
    		}
    	}
    }
    
    /****************************/
    /* 折れ線グラフ(1)の描画 */
    /*      coded by Y.Suganuma */
    /****************************/
    function LineGraph1()
    {
    	let tx = new Array();
    					//
    					// 描画領域の設定
    					//
    	ctx.fillStyle  = 'rgb(255, 255, 255)';
    	ctx.fillRect(10, 10, canvas.width-20, canvas.height-20);
    	let x_l = 15;
    	let x_r = canvas.width - 15;
    	let y_u = 15;
    	let y_d = canvas.height - 15;
    					//
    					// グラフタイトルの表示
    					//
    	let r      = 0.05;   // タイトル領域の割合
    	let f_size = ((y_d - y_u) < (x_r - x_l)) ? Math.floor((y_d - y_u) * r) : Math.floor((x_r - x_l) * r);
    	if (f_size < 5)
    		f_size = 5;
    	if (d_t) {
    		ctx.fillStyle  = 'rgb(0, 0, 0)';
    		ctx.font = f_size + "px 'MS ゴシック'";
    		let met = ctx.measureText(title[0]);
    		let px  = (x_l + x_r) / 2 - met.width / 2;
    		let py  = y_d;
    		ctx.fillText(title[0], px, py);
    		y_d -= f_size;
    	}
    					//
    					// 表示切り替えボタンの設置
    					//
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font = f_size + "px 'MS ゴシック'";
    	let met = ctx.measureText(change);
    	cx  = x_r - met.width - 5;
    	cy  = y_u;
    	cw  = met.width + 5;
    	ch  = f_size + 5;
    	ctx.fillStyle  = 'rgb(255, 215, 0)';
    	ctx.fillRect(cx, cy, cw, ch);
    	ctx.fillStyle  = 'rgb(0, 0, 0)';
    	let px = cx + 2;
    	let py = cy + f_size;
    	ctx.fillText(change, px, py);
    					//
    					// 凡例の表示
    					//
    	if (d_g) {
    		let han = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let met = ctx.measureText(g_title[i1]);
    			if (met.width > han)
    				han = met.width;
    		}
    		han += 15;
    		r    = 0.2;   // 凡例領域の割合
    		let k1 = Math.floor((x_r - x_l) * r);
    		if (han > k1)
    			han = k1;
    		let kx = x_r - han;
    		let ky = y_u + 2 * f_size;
    		let k  = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			ctx.fillStyle  = cl[k];
    			ctx.fillRect(kx, ky-1, 10, 7);
    			ctx.fillStyle  = 'rgb(0, 0, 0)';
    			ctx.fillText(g_title[i1], kx+15, ky+2*f_size/5);
    			k++;
    			if (k > 9)
    				k = 0;
    			ky += (f_size + 5);
    		}
    		x_r -= (han + 10);
    	}
    	else
    		x_r -= Math.floor(0.03 * (x_r - x_l));
    					//
    					// x軸及びy軸のタイトルの表示
    					//
    							// 縦表示
    	ctx.fillStyle = 'rgb(0, 0, 0)';
    	if (ver) {
    		if (title[1].length > 0 && title[1] != "-") {
    			let met = ctx.measureText(title[1]);
    			let px  = (x_l + x_r) / 2 - met.width / 2;
    			let py  = y_d - 5;
    			ctx.fillText(title[1], px, py);
    			y_d -= (f_size + 5);
    		}
    		if (title[2].length > 0 && title[2] != "-") {
    			let met = ctx.measureText(title[2]);
    			let px  = x_l;
    			let py  = y_u + 4 * f_size / 5;
    			ctx.fillText(title[2], px, py);
    			y_u += 4 * f_size / 5;
    		}
    	}
    							// 横表示
    	else {
    		if (title[2].length > 0 && title[2] != "-") {
    			let met = ctx.measureText(title[2]);
    			let px  = (x_l + x_r) / 2 - met.width / 2;
    			let py  = y_d - 5;
    			ctx.fillText(title[2], px, py);
    			y_d -= (f_size + 5);
    		}
    		if (title[1].length > 0 && title[1].localeCompare("-") != 0) {
    			let met = ctx.measureText(title[1]);
    			let px  = x_l;
    			let py  = y_u + 4 * f_size / 5;
    			ctx.fillText(title[1], px, py);
    			y_u += 4 * f_size / 5;
    		}
    	}
    	y_u += 10;
    					//
    					// x軸,y軸,及び,各軸の目盛り
    					//
    	ctx.lineWidth   = 1;
    	ctx.strokeStyle = "rgb(0, 0, 0)";
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font  = f_size + "px 'MS 明朝'";
    	y_d      -= (f_size + 5);
    							// 縦表示
    	if (ver) {
    									// y軸
    		let y1  = y_scale[0];
    		let k   = Math.floor((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		let len = 0;
    		let b   = Math.pow(10, place_y);
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let yy = Math.round(y1 * b).toString();
    			if (place_y == 0)
    				tx[i1] = yy;
    			else {
    				if (yy.length < place_y+1) {
    					let n = place_y + 1 - yy.length;
    					for (let i2 = 0; i2 < n; i2++)
    						yy = "0" + yy;
    				}
    				tx[i1] = yy.substr(0,yy.length-place_y) + "." + yy.substr(yy.length-place_y,place_y);
    			}
    			let met = ctx.measureText(tx[i1]);
    			if (met.width > len)
    				len = met.width;
    			y1 += y_scale[2];
    		}
    		ctx.moveTo(x_l+len+10, y_u);
    		ctx.lineTo(x_l+len+10, y_d);
    		ctx.moveTo(x_r, y_u);
    		ctx.lineTo(x_r, y_d);
    		y1 = y_scale[0];
    		let x1 = y_d;
    		let sp = (y_d - y_u) / k;
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let ky  = Math.floor(Math.round(x1));
    			let met = ctx.measureText(tx[i1]);
    			let k1  = met.width;
    			let px  = x_l + len - k1;
    			let py  = ky + 2 * f_size / 5;
    			ctx.fillText(tx[i1], px, py);
    			ctx.moveTo(x_l+len+10, ky);
    			ctx.lineTo(x_r, ky);
    			y1 += y_scale[2];
    			x1 -= sp;
    		}
    		x_l += (len + 10);
    									// x軸
    		sp  = (x_r - x_l) / n_p;
    		x1  = x_l + sp / 2.0;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			let kx  = Math.floor(Math.round(x1));
    			let met = ctx.measureText(x_title[i1]);
    			let k1  = met.width;
    			let px  = kx - k1 / 2;
    			let py  = y_d + 11 * f_size / 10;
    			ctx.fillText(x_title[i1], px, py);
    			ctx.moveTo(kx, y_d);
    			ctx.lineTo(kx, y_d-5);
    			x1 += sp;
    		}
    	}
    							// 横表示
    	else {
    									// y軸
    		let len = 0;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			let met = ctx.measureText(x_title[i1]);
    			if (met.width > len)
    				len = met.width;
    		}
    		ctx.moveTo(x_l+len+5, y_u);
    		ctx.lineTo(x_l+len+5, y_d);
    		ctx.moveTo(x_r, y_u);
    		ctx.lineTo(x_r, y_d);
    		let sp = (y_d - y_u) / n_p;
    		let y1 = y_d - sp / 2.0;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			let ky  = Math.floor(Math.round(y1));
    			let met = ctx.measureText(x_title[n_p-1-i1]);
    			let k1  = met.width;
    			let px  = x_l + len - k1;
    			let py  = ky + 2 * f_size / 5;
    			ctx.fillText(x_title[n_p-1-i1], px, py);
    			ctx.moveTo(x_l+len+5, ky);
    			ctx.lineTo(x_l+len+10, ky);
    			y1 -= sp;
    		}
    		ctx.moveTo(x_l+len+5, y_u);
    		ctx.lineTo(x_r, y_u);
    		ctx.moveTo(x_l+len+5, y_d);
    		ctx.lineTo(x_r, y_d);
    		x_l += (len + 5);
    									// x軸
    		let k  = Math.floor((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		let x1 = y_scale[0];
    		y1 = x_l;
    		sp = (x_r - x_l) / k;
    		let b = Math.pow(10, place_y);
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let kx = Math.floor(Math.round(y1));
    			let yy = Math.round(x1 * b).toString();
    			let st;
    			if (place_y == 0)
    				st = yy;
    			else {
    				if (yy.length < place_y+1) {
    					nlet  = place_y + 1 - yy.length;
    					for (let i2 = 0; i2 < n; i2++)
    						yy = "0" + yy;
    				}
    				st = yy.substr(0,yy.length-place_y) + "." + yy.substr(yy.length-place_y,place_y);
    			}
    			let met = ctx.measureText(st);
    			let k1  = met.width;
    			let px  = kx - k1 / 2;
    			let py  = y_d + f_size;
    			ctx.fillText(st, px, py);
    			if (i1 < k) {
    				ctx.moveTo(kx, y_d);
    				ctx.lineTo(kx, y_u);
    			}
    			x1 += y_scale[2];
    			y1 += sp;
    		}
    	}
    	ctx.stroke();
    					//
    					// グラフの表示
    					//
    	ctx.lineWidth = line_w;
    	let cr = line_w / 2 + 3;
    									// 縦表示
    	if (ver) {
    		let sp = (x_r - x_l) / n_p;
    		let k1 = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let x1  = x_l + sp / 2.0;
    			let kx1 = 0;
    			let ky1 = 0;
    			ctx.strokeStyle = cl[k1];  
    			ctx.fillStyle   = cl[k1];
    			for (let i2 = 0; i2 < n_p; i2++) {
    				let kx = Math.floor(Math.round(x1));
    				let ky = y_d - Math.floor((y_d - y_u) * (data_y[i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    				if (line_m) {
    					ctx.beginPath();
    					ctx.arc(kx, ky, cr, 0, 2*Math.PI, false);
    					ctx.fill();
    				}
    				if (i2 > 0) {
    					ctx.beginPath();
    					ctx.moveTo(kx1, ky1);
    					ctx.lineTo(kx, ky);
    					ctx.stroke();
    				}
    				kx1  = kx;
    				ky1  = ky;
    				x1  += sp;
    			}
    			k1++;
    			if (k1 > 9)
    				k1 = 0;
    		}
    	}
    									// 横表示
    	else {
    		let sp = (y_d - y_u) / n_p;
    		let k1 = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let y1  = y_d - sp / 2.0;
    			let kx1 = 0;
    			let ky1 = 0;
    			ctx.strokeStyle = cl[k1];  
    			ctx.fillStyle   = cl[k1];
    			for (let i2 = 0; i2 < n_p; i2++) {
    				let ky = Math.floor(Math.round(y1));
    				let kx = x_l + Math.floor((x_r - x_l) * (data_y[i1][n_p-1-i2] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    				if (line_m) {
    					ctx.beginPath();
    					ctx.arc(kx, ky, cr, 0, 2*Math.PI, false);
    					ctx.fill();
    				}
    				if (i2 > 0) {
    					ctx.beginPath();
    					ctx.moveTo(kx1, ky1);
    					ctx.lineTo(kx, ky);
    					ctx.stroke();
    				}
    				kx1  = kx;
    				ky1  = ky;
    				y1  -= sp;
    			}
    			k1++;
    			if (k1 > 9)
    				k1 = 0;
    		}
    	}
    	ctx.lineWidth = 1;
    }
    
    /****************************/
    /* 折れ線グラフ(2)の描画 */
    /*      coded by Y.Suganuma */
    /****************************/
    function LineGraph2()
    {
    	let tx = new Array();
    					//
    					// 描画領域の設定
    					//
    	ctx.fillStyle  = 'rgb(255, 255, 255)';
    	ctx.fillRect(10, 10, canvas.width-20, canvas.height-20);
    	let x_l = 15;
    	let x_r = canvas.width - 15;
    	let y_u = 15;
    	let y_d = canvas.height - 15;
    					//
    					// グラフタイトルの表示
    					//
    	let r      = 0.05;   // タイトル領域の割合
    	let f_size = ((y_d - y_u) < (x_r - x_l)) ? Math.floor((y_d - y_u) * r) : Math.floor((x_r - x_l) * r);
    	if (f_size < 5)
    		f_size = 5;
    	if (d_t) {
    		ctx.fillStyle  = 'rgb(0, 0, 0)';
    		ctx.font = f_size + "px 'MS ゴシック'";
    		let met = ctx.measureText(title[0]);
    		let px  = (x_l + x_r) / 2 - met.width / 2;
    		let py  = y_d;
    		ctx.fillText(title[0], px, py);
    		y_d -= f_size;
    	}
    					//
    					// 表示切り替えボタンの設置
    					//
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font = f_size + "px 'MS ゴシック'";
    	let met = ctx.measureText(change);
    	cx  = x_r - met.width - 5;
    	cy  = y_u;
    	cw  = met.width + 5;
    	ch  = f_size + 5;
    	ctx.fillStyle  = 'rgb(255, 215, 0)';
    	ctx.fillRect(cx, cy, cw, ch);
    	ctx.fillStyle  = 'rgb(0, 0, 0)';
    	let px = cx + 2;
    	let py = cy + f_size;
    	ctx.fillText(change, px, py);
    					//
    					// 凡例の表示
    					//
    	if (d_g) {
    		let han = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let met = ctx.measureText(g_title[i1]);
    			if (met.width > han)
    				han = met.width;
    		}
    		han += 15;
    		r    = 0.2;   // 凡例領域の割合
    		let k1 = Math.floor((x_r - x_l) * r);
    		if (han > k1)
    			han = k1;
    		let kx = x_r - han;
    		let ky = y_u + 2 * f_size;
    		let k  = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			ctx.fillStyle  = cl[k];
    			ctx.fillRect(kx, ky-1, 10, 7);
    			ctx.fillStyle  = 'rgb(0, 0, 0)';
    			ctx.fillText(g_title[i1], kx+15, ky+2*f_size/5);
    			k++;
    			if (k > 9)
    				k = 0;
    			ky += (f_size + 5);
    		}
    		x_r -= (han + 10);
    	}
    	else
    		x_r -= Math.floor(0.03 * (x_r - x_l));
    					//
    					// x軸及びy軸のタイトルの表示
    					//
    							// 縦表示
    	ctx.fillStyle = 'rgb(0, 0, 0)';
    	if (ver) {
    		if (title[1].length > 0 && title[1] != "-") {
    			let met = ctx.measureText(title[1]);
    			let px  = (x_l + x_r) / 2 - met.width / 2;
    			let py  = y_d - 5;
    			ctx.fillText(title[1], px, py);
    			y_d -= (f_size + 5);
    		}
    		if (title[2].length > 0 && title[2] != "-") {
    			let met = ctx.measureText(title[2]);
    			let px  = x_l;
    			let py  = y_u + 4 * f_size / 5;
    			ctx.fillText(title[2], px, py);
    			y_u += 4 * f_size / 5;
    		}
    	}
    							// 横表示
    	else {
    		if (title[2].length > 0 && title[2] != "-") {
    			let met = ctx.measureText(title[2]);
    			let px  = (x_l + x_r) / 2 - met.width / 2;
    			let py  = y_d - 5;
    			ctx.fillText(title[2], px, py);
    			y_d -= (f_size + 5);
    		}
    		if (title[1].length > 0 && title[1].localeCompare("-") != 0) {
    			let met = ctx.measureText(title[1]);
    			let px  = x_l;
    			let py  = y_u + 4 * f_size / 5;
    			ctx.fillText(title[1], px, py);
    			y_u += 4 * f_size / 5;
    		}
    	}
    	y_u += 10;
    					//
    					// x軸,y軸,及び,各軸の目盛り
    					//
    	ctx.lineWidth   = 1;
    	ctx.strokeStyle = "rgb(0, 0, 0)";
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font  = f_size + "px 'MS 明朝'";
    	y_d      -= (f_size + 5);
    							// 縦表示
    	if (ver) {
    									// y軸
    		let y1  = y_scale[0];
    		let k   = Math.floor((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		let len = 0;
    		let b   = Math.pow(10, place_y);
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let yy = Math.round(y1 * b).toString();
    			if (place_y == 0)
    				tx[i1] = yy;
    			else {
    				if (yy.length < place_y+1) {
    					let n = place_y + 1 - yy.length;
    					for (let i2 = 0; i2 < n; i2++)
    						yy = "0" + yy;
    				}
    				tx[i1] = yy.substr(0,yy.length-place_y) + "." + yy.substr(yy.length-place_y,place_y);
    			}
    			let met = ctx.measureText(tx[i1]);
    			if (met.width > len)
    				len = met.width;
    			y1 += y_scale[2];
    		}
    		ctx.moveTo(x_l+len+10, y_u);
    		ctx.lineTo(x_l+len+10, y_d);
    		ctx.moveTo(x_r, y_u);
    		ctx.lineTo(x_r, y_d);
    		y1 = y_scale[0];
    		let x1 = y_d;
    		let sp = (y_d - y_u) / k;
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let ky  = Math.floor(Math.round(x1));
    			let met = ctx.measureText(tx[i1]);
    			let k1  = met.width;
    			let px  = x_l + len - k1;
    			let py  = ky + 2 * f_size / 5;
    			ctx.fillText(tx[i1], px, py);
    			ctx.moveTo(x_l+len+10, ky);
    			ctx.lineTo(x_r, ky);
    			y1 += y_scale[2];
    			x1 -= sp;
    		}
    		x_l += (len + 10);
    									// x軸
    		k  = Math.floor((x_scale[1] - x_scale[0]) / (0.99 * x_scale[2]));
    		x1 = x_scale[0];
    		y1 = x_l;
    		sp = (x_r - x_l) / k;
    		b  = Math.pow(10, place_x);
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let kx = Math.floor(Math.round(y1));
    			let yy = Math.round(x1 * b).toString();
    			let st;
    			if (place_x == 0)
    				st = yy;
    			else {
    				if (yy.length < place_x+1) {
    					let n = place_x + 1 - yy.length;
    					for (let i2 = 0; i2 < n; i2++)
    						yy = "0" + yy;
    				}
    				st = yy.substr(0,yy.length-place_x) + "." + yy.substr(yy.length-place_x,place_x);
    			}
    			met = ctx.measureText(st);
    			let k1  = met.width;
    			let px  = kx - k1 / 2;
    			let py  = y_d + f_size;
    			ctx.fillText(st, px, py);
    			if (i1 < k) {
    				ctx.moveTo(kx, y_d);
    				ctx.lineTo(kx, y_u);
    			}
    			x1 += x_scale[2];
    			y1 += sp;
    		}
    	}
    							// 横表示
    	else {
    									// y軸
    		let y1  = x_scale[0];
    		let k   = Math.floor((x_scale[1] - x_scale[0]) / (0.99 * x_scale[2]));
    		let len = 0;
    		let b   = Math.pow(10, place_x);
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let yy = Math.round(y1 * b).toString();
    			if (place_x == 0)
    				tx[i1] = yy;
    			else {
    				if (yy.length < place_x+1) {
    					let n = place_x + 1 - yy.length;
    					for (let i2 = 0; i2 < n; i2++)
    						yy = "0" + yy;
    				}
    				tx[i1] = yy.substr(0,yy.length-place_x) + "." + yy.substr(yy.length-place_x,place_x);
    			}
    			let met = ctx.measureText(tx[i1]);
    			if (met.width > len)
    				len = met.width;
    			y1 += x_scale[2];
    		}
    		ctx.moveTo(x_l+len+10, y_u);
    		ctx.lineTo(x_l+len+10, y_d);
    		ctx.moveTo(x_r, y_u);
    		ctx.lineTo(x_r, y_d);
    		y1 = x_scale[0];
    		let x1 = y_d;
    		let sp = (y_d - y_u) / k;
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let ky  = Math.floor(Math.round(x1));
    			let met = ctx.measureText(tx[i1]);
    			let k1  = met.width;
    			let px  = x_l + len - k1;
    			let py  = ky + 2 * f_size / 5;
    			ctx.fillText(tx[i1], px, py);
    			ctx.moveTo(x_l+len+10, ky);
    			ctx.lineTo(x_r, ky);
    			y1 += x_scale[2];
    			x1 -= sp;
    		}
    		x_l += (len + 10);
    									// x軸
    		k  = Math.floor((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		x1 = y_scale[0];
    		y1 = x_l;
    		sp = (x_r - x_l) / k;
    		b  = Math.pow(10, place_y);
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let kx = Math.floor(Math.round(y1));
    			let yy = Math.round(x1 * b).toString();
    			let st;
    			if (place_y == 0)
    				st = yy;
    			else {
    				if (yy.length < place_y+1) {
    					let n = place_y + 1 - yy.length;
    					for (let i2 = 0; i2 < n; i2++)
    						yy = "0" + yy;
    				}
    				st = yy.substr(0,yy.length-place_y) + "." + yy.substr(yy.length-place_y,place_y);
    			}
    			let met = ctx.measureText(st);
    			let k1  = met.width;
    			let px  = kx - k1 / 2;
    			let py  = y_d + f_size;
    			ctx.fillText(st, px, py);
    			if (i1 < k) {
    				ctx.moveTo(kx, y_d);
    				ctx.lineTo(kx, y_u);
    			}
    			x1 += y_scale[2];
    			y1 += sp;
    		}
    	}
    	ctx.stroke();
    					//
    					// グラフの表示
    					//
    	ctx.lineWidth = line_w;
    	let cr = line_w / 2 + 3;
    							// 縦表示
    	if (ver) {
    		let k1 = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let kx1 = 0;
    			let ky1 = 0;
    			ctx.strokeStyle = cl[k1];  
    			ctx.fillStyle   = cl[k1];
    			for (let i2 = 0; i2 < n_p; i2++) {
    				let kx = x_l + Math.floor((x_r - x_l) * (data_x[i1][i2] - x_scale[0]) / (x_scale[1] - x_scale[0]));
    				let ky = y_d - Math.floor((y_d - y_u) * (data_y[i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    				if (line_m) {
    					ctx.beginPath();
    					ctx.arc(kx, ky, cr, 0, 2*Math.PI, false);
    					ctx.fill();
    				}
    				if (i2 > 0) {
    					ctx.beginPath();
    					ctx.moveTo(kx1, ky1);
    					ctx.lineTo(kx, ky);
    					ctx.stroke();
    				}
    				kx1 = kx;
    				ky1 = ky;
    			}
    			k1++;
    			if (k1 > 9)
    				k1 = 0;
    		}
    	}
    							// 横表示
    	else {
    		let k1  = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let kx1 = 0;
    			let ky1 = 0;
    			ctx.strokeStyle = cl[k1];  
    			ctx.fillStyle   = cl[k1];
    			for (let i2 = 0; i2 < n_p; i2++) {
    				let kx = x_l + Math.floor((x_r - x_l) * (data_y[i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    				let ky = y_d - Math.floor((y_d - y_u) * (data_x[i1][i2] - x_scale[0]) / (x_scale[1] - x_scale[0]));
    				if (line_m) {
    					ctx.beginPath();
    					ctx.arc(kx, ky, cr, 0, 2*Math.PI, false);
    					ctx.fill();
    				}
    				if (i2 > 0) {
    					ctx.beginPath();
    					ctx.moveTo(kx1, ky1);
    					ctx.lineTo(kx, ky);
    					ctx.stroke();
    				}
    				kx1 = kx;
    				ky1 = ky;
    			}
    			k1++;
    			if (k1 > 9)
    				k1 = 0;
    		}
    	}
    	ctx.lineWidth = 1;
    }
    
    /****************************/
    /* 積み上げ棒グラフの描画   */
    /*      coded by Y.Suganuma */
    /****************************/
    function StackGraph()
    {
    	let tx = new Array();
    					//
    					// 描画領域の設定
    					//
    	ctx.fillStyle  = 'rgb(255, 255, 255)';
    	ctx.fillRect(10, 10, canvas.width-20, canvas.height-20);
    	let x_l = 15;
    	let x_r = canvas.width - 15;
    	let y_u = 15;
    	let y_d = canvas.height - 15;
    					//
    					// グラフタイトルの表示
    					//
    	let r      = 0.05;   // タイトル領域の割合
    	let f_size = ((y_d - y_u) < (x_r - x_l)) ? Math.floor((y_d - y_u) * r) : Math.floor((x_r - x_l) * r);
    	if (f_size < 5)
    		f_size = 5;
    	if (d_t) {
    		ctx.fillStyle  = 'rgb(0, 0, 0)';
    		ctx.font = f_size + "px 'MS ゴシック'";
    		let met = ctx.measureText(title[0]);
    		let px  = (x_l + x_r) / 2 - met.width / 2;
    		let py  = y_d;
    		ctx.fillText(title[0], px, py);
    		y_d -= f_size;
    	}
    					//
    					// 表示切り替えボタンの設置
    					//
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font = f_size + "px 'MS ゴシック'";
    	let met = ctx.measureText(change);
    	cx  = x_r - met.width - 5;
    	cy  = y_u;
    	cw  = met.width + 5;
    	ch  = f_size + 5;
    	ctx.fillStyle  = 'rgb(255, 215, 0)';
    	ctx.fillRect(cx, cy, cw, ch);
    	ctx.fillStyle  = 'rgb(0, 0, 0)';
    	let px = cx + 2;
    	let py = cy + f_size;
    	ctx.fillText(change, px, py);
    					//
    					// 凡例の表示
    					//
    	if (d_g) {
    		let han = 0;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			let met = ctx.measureText(x_title[i1]);
    			if (met.width > han)
    				han = met.width;
    		}
    		han += 15;
    		r    = 0.2;   // 凡例領域の割合
    		let k1 = Math.floor((x_r - x_l) * r);
    		if (han > k1)
    			han = k1;
    		let kx = x_r - han;
    		let ky = y_u + 2 * f_size;
    		let k  = 0;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			ctx.fillStyle  = cl[k];
    			ctx.fillRect(kx, ky-1, 10, 7);
    			ctx.fillStyle  = 'rgb(0, 0, 0)';
    			ctx.fillText(x_title[i1], kx+15, ky+2*f_size/5);
    			k++;
    			if (k > 9)
    				k = 0;
    			ky += (f_size + 5);
    		}
    		x_r -= (han + 10);
    	}
    	else
    		x_r -= Math.floor(0.03 * (x_r - x_l));
    					//
    					// x軸及びy軸のタイトルの表示
    					//
    							// 縦表示
    	ctx.fillStyle = 'rgb(0, 0, 0)';
    	if (ver) {
    		if (title[1].length > 0 && title[1] != "-") {
    			let met = ctx.measureText(title[1]);
    			let px  = (x_l + x_r) / 2 - met.width / 2;
    			let py  = y_d - 5;
    			ctx.fillText(title[1], px, py);
    			y_d -= (f_size + 5);
    		}
    		if (title[2].length > 0 && title[2] != "-") {
    			let met = ctx.measureText(title[2]);
    			let px  = x_l;
    			let py  = y_u + 4 * f_size / 5;
    			ctx.fillText(title[2], px, py);
    			y_u += 4 * f_size / 5;
    		}
    	}
    							// 横表示
    	else {
    		if (title[2].length > 0 && title[2] != "-") {
    			let met = ctx.measureText(title[2]);
    			let px  = (x_l + x_r) / 2 - met.width / 2;
    			let py  = y_d - 5;
    			ctx.fillText(title[2], px, py);
    			y_d -= (f_size + 5);
    		}
    		if (title[1].length > 0 && title[1].localeCompare("-") != 0) {
    			let met = ctx.measureText(title[1]);
    			let px  = x_l;
    			let py  = y_u + 4 * f_size / 5;
    			ctx.fillText(title[1], px, py);
    			y_u += 4 * f_size / 5;
    		}
    	}
    	y_u += 10;
    					//
    					// x軸,y軸,及び,各軸の目盛り
    					//
    	ctx.lineWidth   = 1;
    	ctx.strokeStyle = "rgb(0, 0, 0)";
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font  = f_size + "px 'MS 明朝'";
    	y_d      -= (f_size + 5);
    							// 縦表示
    	if (ver) {
    									// y軸
    		let y1  = y_scale[0];
    		let k   = Math.floor((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		let len = 0;
    		let b   = Math.pow(10, place_y);
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let yy = Math.round(y1 * b).toString();
    			if (place_y == 0)
    				tx[i1] = yy;
    			else {
    				if (yy.length < place_y+1) {
    					let n = place_y + 1 - yy.length;
    					for (let i2 = 0; i2 < n; i2++)
    						yy = "0" + yy;
    				}
    				tx[i1] = yy.substr(0,yy.length-place_y) + "." + yy.substr(yy.length-place_y,place_y);
    			}
    			let met = ctx.measureText(tx[i1]);
    			if (met.width > len)
    				len = met.width;
    			y1 += y_scale[2];
    		}
    		ctx.moveTo(x_l+len+10, y_u);
    		ctx.lineTo(x_l+len+10, y_d);
    		ctx.moveTo(x_r, y_u);
    		ctx.lineTo(x_r, y_d);
    		y1 = y_scale[0];
    		let x1 = y_d;
    		let sp = (y_d - y_u) / k;
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let ky  = Math.floor(Math.round(x1));
    			let met = ctx.measureText(tx[i1]);
    			let k1  = met.width;
    			let px  = x_l + len - k1;
    			let py  = ky + 2 * f_size / 5;
    			ctx.fillText(tx[i1], px, py);
    			ctx.moveTo(x_l+len+10, ky);
    			ctx.lineTo(x_r, ky);
    			y1 += y_scale[2];
    			x1 -= sp;
    		}
    		x_l += (len + 10);
    									// x軸
    		sp  = (x_r - x_l) / n_g;
    		x1  = x_l + sp / 2.0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let kx  = Math.floor(Math.round(x1));
    			let met = ctx.measureText(g_title[i1]);
    			let k1  = met.width;
    			let px  = kx - k1 / 2;
    			let py  = y_d + 11 * f_size / 10;
    			ctx.fillText(g_title[i1], px, py);
    			ctx.moveTo(kx, y_d);
    			ctx.lineTo(kx, y_d-5);
    			x1 += sp;
    		}
    	}
    							// 横表示
    	else {
    									// y軸
    		let len = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let met = ctx.measureText(g_title[i1]);
    			if (met.width > len)
    				len = met.width;
    		}
    		ctx.moveTo(x_l+len+5, y_u);
    		ctx.lineTo(x_l+len+5, y_d);
    		ctx.moveTo(x_r, y_u);
    		ctx.lineTo(x_r, y_d);
    		let sp = (y_d - y_u) / n_g;
    		let y1 = y_d - sp / 2.0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let ky  = Math.floor(Math.round(y1));
    			let met = ctx.measureText(g_title[n_g-1-i1]);
    			let k1  = met.width;
    			let px  = x_l + len - k1;
    			let py  = ky + 2 * f_size / 5;
    			ctx.fillText(g_title[n_g-1-i1], px, py);
    			ctx.moveTo(x_l+len+5, ky);
    			ctx.lineTo(x_l+len+10, ky);
    			y1 -= sp;
    		}
    		ctx.moveTo(x_l+len+5, y_u);
    		ctx.lineTo(x_r, y_u);
    		ctx.moveTo(x_l+len+5, y_d);
    		ctx.lineTo(x_r, y_d);
    		x_l += (len + 5);
    									// x軸
    		let k  = Math.floor((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    		let x1 = y_scale[0];
    		y1 = x_l;
    		sp = (x_r - x_l) / k;
    		let b = Math.pow(10, place_y);
    		for (let i1 = 0; i1 < k+1; i1++) {
    			let kx = Math.floor(Math.round(y1));
    			let yy = Math.round(x1 * b).toString();
    			let st;
    			if (place_y == 0)
    				st = yy;
    			else {
    				if (yy.length < place_y+1) {
    					let n = place_y + 1 - yy.length;
    					for (let i2 = 0; i2 < n; i2++)
    						yy = "0" + yy;
    				}
    				st = yy.substr(0,yy.length-place_y) + "." + yy.substr(yy.length-place_y,place_y);
    			}
    			let met = ctx.measureText(st);
    			let k1  = met.width;
    			let px  = kx - k1 / 2;
    			let py  = y_d + f_size;
    			ctx.fillText(st, px, py);
    			if (i1 < k) {
    				ctx.moveTo(kx, y_d);
    				ctx.lineTo(kx, y_u);
    			}
    			x1 += y_scale[2];
    			y1 += sp;
    		}
    	}
    	ctx.stroke();
    					//
    					// グラフの表示
    					//
    							// 縦表示
    	if (ver) {
    		let g_w = Math.floor(0.8 * (x_r - x_l) / n_g);
    		let sp  = (x_r - x_l) / n_g;
    		let x1  = x_l + sp / 2.0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let kx = Math.round(x1);
    			let k1 = 0;
    			let y1 = y_d;
    			for (let i2 = 0; i2 < n_p; i2++) {
    				let ky = Math.round(y1);
    				let y2 = (y_d - y_u) * (data_y[i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]);
    				let k2 = Math.round(y2);
    				ctx.fillStyle = cl[k1];
    				ctx.fillRect(kx-g_w/2, ky-k2, g_w, k2);
    				y1 -= y2;
    				k1++;
    				if (k1 > 9)
    					k1 = 0;
    			}
    			x1 += sp;
    		}
    	}
    							// 横表示
    	else {
    		let g_w = Math.floor(0.8 * (y_d - y_u) / n_g);
    		let sp  = (y_d - y_u) / n_g;
    		let y1  = y_d - sp / 2.0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let ky = Math.round(y1);
    			let k1 = 0;
    			let x1 = x_l;
    			for (let i2 = 0; i2 < n_p; i2++) {
    				let kx = Math.round(x1);
    				let y2 = (x_r - x_l) * (data_y[n_g-1-i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]);
    				let k2 = Math.round(y2);
    				ctx.fillStyle = cl[k1];
    				ctx.fillRect(kx, ky-g_w/2, k2, g_w);
    				x1 += y2;
    				k1++;
    				if (k1 > 9)
    					k1 = 0;
    			}
    			y1 -= sp;
    		}
    	}
    }
    
    /****************************/
    /* 円グラフの描画           */
    /*      coded by Y.Suganuma */
    /****************************/
    function PieGraph()
    {
    	let tx = new Array();
    					//
    					// 描画領域の設定
    					//
    	ctx.fillStyle  = 'rgb(255, 255, 255)';
    	ctx.fillRect(10, 10, canvas.width-20, canvas.height-20);
    	let x_l = 15;
    	let x_r = canvas.width - 15;
    	let y_u = 15;
    	let y_d = canvas.height - 15;
    					//
    					// グラフタイトルの表示
    					//
    	let r      = 0.05;   // タイトル領域の割合
    	let f_size = ((y_d - y_u) < (x_r - x_l)) ? Math.floor((y_d - y_u) * r) : Math.floor((x_r - x_l) * r);
    	if (f_size < 5)
    		f_size = 5;
    	if (d_t) {
    		ctx.fillStyle  = 'rgb(0, 0, 0)';
    		ctx.font = f_size + "px 'MS ゴシック'";
    		let met = ctx.measureText(title[0]);
    		let px  = (x_l + x_r) / 2 - met.width / 2;
    		let py  = y_d;
    		ctx.fillText(title[0], px, py);
    		y_d -= f_size;
    	}
    					//
    					// 表示切り替えボタンの設置
    					//
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font = f_size + "px 'MS ゴシック'";
    	let met = ctx.measureText(change);
    	cx  = x_r - met.width - 5;
    	cy  = y_u;
    	cw  = met.width + 5;
    	ch  = f_size + 5;
    	ctx.fillStyle  = 'rgb(255, 215, 0)';
    	ctx.fillRect(cx, cy, cw, ch);
    	ctx.fillStyle  = 'rgb(0, 0, 0)';
    	let px = cx + 2;
    	let py = cy + f_size;
    	ctx.fillText(change, px, py);
    					//
    					// 凡例の表示
    					//
    	let k = 0;
    	if (d_g) {
    		let han = 0;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			let met = ctx.measureText(x_title[i1]);
    			if (met.width > han)
    				han = met.width;
    		}
    		han += 15;
    		r    = 0.2;   // 凡例領域の割合
    		let k1 = Math.floor((x_r - x_l) * r);
    		if (han > k1)
    			han = k1;
    		let kx = x_r - han;
    		let ky = y_u + 2 * f_size;
    		for (let i1 = 0; i1 < n_p; i1++) {
    			ctx.fillStyle  = cl[k];
    			ctx.fillRect(kx, ky-1, 10, 7);
    			ctx.fillStyle  = 'rgb(0, 0, 0)';
    			ctx.fillText(x_title[i1], kx+15, ky+2*f_size/5);
    			k++;
    			if (k > 9)
    				k = 0;
    			ky += (f_size + 5);
    		}
    		x_r -= (han + 10);
    	}
    	else
    		x_r -= Math.floor(0.03 * (x_r - x_l));
    					//
    					// グラフの表示
    					//
    	let k1;
    	if (x_r-x_l < y_d-y_u)
    		k1 = x_r - x_l;
    	else
    		k1 = y_d - y_u;
    	let len = 9 * k1 / 20;
    	let kx  = (x_r + x_l) / 2;
    	let ky  = (y_d + y_u) / 2;
    	let a1  = 90;
    	let a2  = a1 + Math.round(3.60 * data_y[n_p-1]);
    	k--;
    	if (k < 0)
    		k = 9;
    	for (let i1 = 0; i1 < n_p; i1++) {
    		let x1 = kx + len * Math.cos(Math.PI * a1 / 180.0);
    		let y1 = ky - len * Math.sin(Math.PI * a1 / 180.0);
    		ctx.beginPath();
    		ctx.moveTo(kx, ky);
    		ctx.fillStyle   = cl[k];
    		ctx.strokeStyle = cl[k];
    		ctx.lineTo(x1, y1);
    		for (let a = a1+1; a <= a2; a++) {
    			x1 = kx + len * Math.cos(Math.PI * a / 180.0);
    			y1 = ky - len * Math.sin(Math.PI * a / 180.0);
    			ctx.lineTo(x1, y1);
    		}
    		ctx.closePath();
    		ctx.fill();
    		if (i1 < n_p-1) {
    			a1 = a2;
    			a2 = a1 + Math.round(3.60 * data_y[n_p-2-i1]);
    			k--;
    			if (k < 0)
    				k = 9;
    		}
    	}
    }
    
    /****************************/
    /* 散布図の描画             */
    /*      coded by Y.Suganuma */
    /****************************/
    function ScatterDiagram()
    {
    	let tx = new Array();
    					//
    					// 描画領域の設定
    					//
    	ctx.fillStyle  = 'rgb(255, 255, 255)';
    	ctx.fillRect(10, 10, canvas.width-20, canvas.height-20);
    	let x_l = 15;
    	let x_r = canvas.width - 15;
    	let y_u = 15;
    	let y_d = canvas.height - 15;
    					//
    					// グラフタイトルの表示
    					//
    	let r      = 0.05;   // タイトル領域の割合
    	let f_size = ((y_d - y_u) < (x_r - x_l)) ? Math.floor((y_d - y_u) * r) : Math.floor((x_r - x_l) * r);
    	if (f_size < 5)
    		f_size = 5;
    	if (d_t) {
    		ctx.fillStyle  = 'rgb(0, 0, 0)';
    		ctx.font = f_size + "px 'MS ゴシック'";
    		let met = ctx.measureText(title[0]);
    		let px  = (x_l + x_r) / 2 - met.width / 2;
    		let py  = y_d;
    		ctx.fillText(title[0], px, py);
    		y_d -= f_size;
    	}
    					//
    					// x軸及びy軸のタイトルの表示
    					//
    	x_r    -= Math.floor(0.03 * (x_r - x_l));
    	f_size  = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font      = f_size + "px 'MS ゴシック'";
    	ctx.fillStyle = 'rgb(0, 0, 0)';
    	if (title[1].length > 0 && title[1] != "-") {
    		let met = ctx.measureText(title[1]);
    		let px  = (x_l + x_r) / 2 - met.width / 2;
    		let py  = y_d - 5;
    		ctx.fillText(title[1], px, py);
    		y_d -= (f_size + 5);
    	}
    	if (title[2].length > 0 && title[2] != "-") {
    		let met = ctx.measureText(title[2]);
    		let px  = x_l;
    		let py  = y_u + 4 * f_size / 5;
    		ctx.fillText(title[2], px, py);
    		y_u += 7 * f_size / 5;
    	}
    					//
    					// x軸,y軸,及び,各軸の目盛り
    					//
    	ctx.lineWidth   = 1;
    	ctx.strokeStyle = "rgb(0, 0, 0)";
    	ctx.fillStyle   = "rgb(0, 0, 0)";
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font  = f_size + "px 'MS 明朝'";
    	y_d      -= (f_size + 5);
    							// y軸
    	let y1  = y_scale[0];
    	let k   = Math.floor((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    	let len = 0;
    	let b   = Math.pow(10, place_y);
    	for (let i1 = 0; i1 < k+1; i1++) {
    		let yy = Math.round(y1 * b).toString();
    		if (place_y == 0)
    			tx[i1] = yy;
    		else {
    			if (yy.length < place_y+1) {
    				let n = place_y + 1 - yy.length;
    				for (let i2 = 0; i2 < n; i2++)
    					yy = "0" + yy;
    			}
    			tx[i1] = yy.substr(0,yy.length-place_y) + "." + yy.substr(yy.length-place_y,place_y);
    		}
    		let met = ctx.measureText(tx[i1]);
    		if (met.width > len)
    			len = met.width;
    		y1 += y_scale[2];
    	}
    	ctx.moveTo(x_l+len+10, y_u);
    	ctx.lineTo(x_l+len+10, y_d);
    	ctx.moveTo(x_r, y_u);
    	ctx.lineTo(x_r, y_d);
    	y1 = y_scale[0];
    	let x1 = y_d;
    	let sp = (y_d - y_u) / k;
    	for (let i1 = 0; i1 < k+1; i1++) {
    		let ky  = Math.floor(Math.round(x1));
    		let met = ctx.measureText(tx[i1]);
    		let k1  = met.width;
    		let px  = x_l + len - k1;
    		let py  = ky + 2 * f_size / 5;
    		ctx.fillText(tx[i1], px, py);
    		ctx.moveTo(x_l+len+10, ky);
    		ctx.lineTo(x_r, ky);
    		y1 += y_scale[2];
    		x1 -= sp;
    	}
    	x_l += (len + 10);
    							// x軸
    	k  = Math.floor((x_scale[1] - x_scale[0]) / (0.99 * x_scale[2]));
    	x1 = x_scale[0];
    	y1 = x_l;
    	sp = (x_r - x_l) / k;
    	b  = Math.pow(10, place_x);
    	for (let i1 = 0; i1 < k+1; i1++) {
    		let kx = Math.floor(Math.round(y1));
    		let yy = Math.round(x1 * b).toString();
    		let st;
    		if (place_x == 0)
    			st = yy;
    		else {
    			if (yy.length < place_x+1) {
    				let n = place_x + 1 - yy.length;
    				for (let i2 = 0; i2 < n; i2++)
    					yy = "0" + yy;
    			}
    			st = yy.substr(0,yy.length-place_x) + "." + yy.substr(yy.length-place_x,place_x);
    		}
    		let met = ctx.measureText(st);
    		let k1  = met.width;
    		let px  = kx - k1 / 2;
    		let py  = y_d + f_size;
    		ctx.fillText(st, px, py);
    		if (i1 < k) {
    			ctx.moveTo(kx, y_d);
    			ctx.lineTo(kx, y_u);
    		}
    		x1 += x_scale[2];
    		y1 += sp;
    	}
    	ctx.stroke();
    					//
    					// グラフの表示
    					//
    	let cr = f_size / 4;
    	if (cr == 0)
    		cr = 1;
    	for (let i1 = 0; i1 < n_p; i1++) {
    		let kx = x_l + Math.floor((x_r - x_l) * (data_y[0][i1] - x_scale[0]) / (x_scale[1] - x_scale[0]));
    		let ky = y_d - Math.floor((y_d - y_u) * (data_y[1][i1] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    		ctx.beginPath();
    		ctx.arc(kx, ky, cr, 0, 2*Math.PI, false);
    		ctx.fill();
    	}
    					//
    					// 相関係数
    					//
    	let vii = 0.0;
    	let vjj = 0.0;
    	let vij = 0.0;
    	let mi  = 0.0;
    	let mj  = 0.0;
    	for (let i1 = 0; i1 < n_p; i1++) {
    		mi += data_y[0][i1];
    		mj += data_y[1][i1];
    	}
    	mi /= n_p;
    	mj /= n_p;
    	for (let i1 = 0; i1 < n_p; i1++) {
    		vii += (data_y[0][i1] - mi) * (data_y[0][i1] - mi);
    		vjj += (data_y[1][i1] - mj) * (data_y[1][i1] - mj);
    		vij += (data_y[0][i1] - mi) * (data_y[1][i1] - mj);
    	}
    	vii /= (n_p - 1);
    	vjj /= (n_p - 1);
    	vij /= (n_p - 1);
    	x1 = vij / (Math.sqrt(vii) * Math.sqrt(vjj));
    	ctx.font = f_size + "px 'MS ゴシック'";
    	let yy = Math.round(x1 * 1000);
    	yy /= 1000;
    	let st  = "相関係数: " + yy;
    	let met = ctx.measureText(st);
    	let k1  = met.width;
    	let px  = x_r - met.width;
    	let py  = y_u - f_size;
    	ctx.fillText(st, px, py);
    }
    
    /****************************/
    /* レーダーチャートの描画   */
    /*      coded by Y.Suganuma */
    /****************************/
    function RadarChart()
    {
    	let tx = new Array();
    					//
    					// 描画領域の設定
    					//
    	ctx.fillStyle  = 'rgb(255, 255, 255)';
    	ctx.fillRect(10, 10, canvas.width-20, canvas.height-20);
    	let x_l = 15;
    	let x_r = canvas.width - 15;
    	let y_u = 15;
    	let y_d = canvas.height - 15;
    					//
    					// グラフタイトルの表示
    					//
    	let r      = 0.05;   // タイトル領域の割合
    	let f_size = ((y_d - y_u) < (x_r - x_l)) ? Math.floor((y_d - y_u) * r) : Math.floor((x_r - x_l) * r);
    	if (f_size < 5)
    		f_size = 5;
    	if (d_t) {
    		ctx.fillStyle  = 'rgb(0, 0, 0)';
    		ctx.font = f_size + "px 'MS ゴシック'";
    		let met = ctx.measureText(title[0]);
    		let px  = (x_l + x_r) / 2 - met.width / 2;
    		let py  = y_d;
    		ctx.fillText(title[0], px, py);
    		y_d -= f_size;
    	}
    					//
    					// 表示切り替えボタンの設置
    					//
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font = f_size + "px 'MS ゴシック'";
    	let met = ctx.measureText(change);
    	cx  = x_r - met.width - 5;
    	cy  = y_u;
    	cw  = met.width + 5;
    	ch  = f_size + 5;
    	ctx.fillStyle  = 'rgb(255, 215, 0)';
    	ctx.fillRect(cx, cy, cw, ch);
    	ctx.fillStyle  = 'rgb(0, 0, 0)';
    	let px = cx + 2;
    	let py = cy + f_size;
    	ctx.fillText(change, px, py);
    					//
    					// 凡例の表示
    					//
    	if (d_g) {
    		let han = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let met = ctx.measureText(g_title[i1]);
    			if (met.width > han)
    				han = met.width;
    		}
    		han += 15;
    		r    = 0.2;   // 凡例領域の割合
    		let k1 = Math.floor((x_r - x_l) * r);
    		if (han > k1)
    			han = k1;
    		let kx = x_r - han;
    		let ky = y_u + 2 * f_size;
    		let k  = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			ctx.fillStyle  = cl[k];
    			ctx.fillRect(kx, ky-1, 10, 7);
    			ctx.fillStyle  = 'rgb(0, 0, 0)';
    			ctx.fillText(g_title[i1], kx+15, ky+2*f_size/5);
    			k++;
    			if (k > 9)
    				k = 0;
    			ky += (f_size + 5);
    		}
    		x_r -= (han + 10);
    	}
    	else
    		x_r -= Math.floor(0.03 * (x_r - x_l));
    					//
    					// 軸,及び,軸の目盛り
    					//
    							// フォントサイズ
    	f_size = Math.floor(0.7 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font = f_size + "px 'MS 明朝'";
    							// 大きさの決定
    	let a   = 0.5 * Math.PI;
    	let aa  = 2.0 * Math.PI / n_p;
    	let x11 = 0.0;
    	let x12 = 0.0;
    	let x21 = 0.0;
    	let x22 = 0.0;
    	let y11 = 0.0;
    	let y12 = 0.0;
    	let y21 = 0.0;
    	let y22 = 0.0;
    	for (let i1 = 0; i1 < n_p; i1++) {
    		let xx  = 100 * Math.cos(a);
    		let yy  = 100 * Math.sin(a);
    		let met = ctx.measureText(x_title[i1]);
    		let k1  = met.width;
    		if (i1 == 0) {
    			x12 = 0.5 * k1;
    			x22 = x12;
    			y11 = 100.0;
    			y12 = 5.0 * f_size / 4.0;
    		}
    		else if (Math.abs(xx) < 1.0e-5) {
    			let x0 = 0.5 * k1;
    			if (x0 > x12)
    				x12 = x0;
    			if (x0 > x22)
    				x22 = x0;
    			y21 = 100.0;
    			y22 = f_size + 5.0;
    		}
    		else {
    			if (yy < 0.0) {
    				let y0 = -yy + 0.5 * f_size;
    				if (y0 > y21+y22) {
    					y21 = -yy;
    					y22 = 0.5 * f_size;
    				}
    			}
    			if (xx > 0.0) {
    				let x0 = xx + k1 + 5.0;
    				if (x0 > x21+x22) {
    					x21 = xx;
    					x22 = k1 + 5.0;
    				}
    			}
    			else {
    				let x0 = -xx + k1 + 5.0;
    				if (x0 > x11+x12) {
    					x11 = -xx;
    					x12 = k1 + 5.0;
    				}
    			}
    		}
    		a += aa;
    	}
    	let x0 = x12 + x22;
    	let xx = (x_r - x_l - x0 - 10) / (x11 + x21);
    	let y0 = y12 + y22;
    	let yy = (y_d - y_u - y0 - 10) / (y11 + y21);
    	r = (xx < yy) ? xx : yy;
    	let cr = Math.floor(100 * r);
    	xx = x_l + r * x11 + x12 + 5.0;
    	let cxx = Math.floor(xx + (x_r - x_l - r * x11 - x12 - r * x21 - x22 - 5) / 2);
    	yy = y_u + r * y11 + y12 + 5.0;
    	let cyy = Math.floor(yy + (y_d - y_u - r * y11 - y12 - r * y21 - y22 - 5) / 2);
    							// 軸とタイトルの描画
    	ctx.lineWidth   = 1;
    	ctx.strokeStyle = "rgb(0, 0, 0)";
    	let k = Math.floor((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2])) + 1;
    	xx = cr / k;
    	a  = 0.5 * Math.PI;
    	aa = 2.0 * Math.PI / n_p;
    	for (let i1 = 0; i1 < n_p; i1++) {
    		let kx  = Math.round(cr * Math.cos(a));
    		let ky  = Math.round(cr * Math.sin(a));
    		let met = ctx.measureText(x_title[i1]);
    		let k1  = met.width;
    		ctx.moveTo(cxx, cyy);
    		ctx.lineTo(cxx+kx, cyy-ky);
    		yy = xx;
    		for (let i2 = 0; i2 < k; i2++) {
    			let kx0 = cxx + Math.round(yy * Math.cos(a));
    			let ky0 = cyy - Math.round(yy * Math.sin(a));
    			let kx1 = kx0 + Math.round(3 * Math.cos(a+0.5*Math.PI));
    			let ky1 = ky0 - Math.round(3 * Math.sin(a+0.5*Math.PI));
    			let kx2 = kx0 + Math.round(3 * Math.cos(a-0.5*Math.PI));
    			let ky2 = ky0 - Math.round(3 * Math.sin(a-0.5*Math.PI));
    			ctx.moveTo(kx1, ky1);
    			ctx.lineTo(kx2, ky2);
    			yy += xx;
    		}
    		if (i1 == 0) {
    			let met = ctx.measureText(x_title[i1]);
    			ctx.fillText(x_title[i1], cxx+kx-k1/2, cyy-ky-4*f_size/5);
    			yy = xx;
    			let sp = y_scale[0];
    			for (let i2 = 0; i2 < k; i2++) {
    				let kx0 = cxx + Math.round(yy * Math.cos(a)) + 5;
    				let ky0 = cyy - Math.floor(Math.round(yy * Math.sin(a)) - 3 * f_size / 10);
    				let b   = Math.pow(10, place_y);
    				let zz  = Math.round(sp * b).toString();
    				if (place_y == 0)
    					tx[i2] = zz;
    				else {
    					if (zz.length < place_y+1) {
    						let n = place_y + 1 - zz.length;
    						for (let i2 = 0; i2 < n; i2++)
    							zz = "0" + zz;
    					}
    					tx[i2] = zz.substr(0,zz.length-place_y) + "." + zz.substr(zz.length-place_y,place_y);
    				}
    				let met = ctx.measureText(tx[i2]);
    				ctx.fillText(tx[i2], kx0, ky0);
    				yy += xx;
    				sp += y_scale[2];
    			}
    		}
    		else {
    			let met = ctx.measureText(x_title[i1]);
    			let px;
    			let py;
    			if (kx == 0) {
    				px = cxx + kx - k1 / 2;
    				py = cyy - ky + 5 * f_size / 4;
    			}
    			else if (kx > 0) {
    				px = cxx + kx + 5;
    				py = cyy - ky + 3 * f_size / 10;
    			}
    			else {
    				px = cxx + kx - k1 - 10;
    				py = cyy - ky + 3 * f_size / 10;
    			}
    			ctx.fillText(x_title[i1], px, py);
    		}
    		a += aa;
    	}
    	ctx.stroke();
    					//
    					// グラフの表示
    					//
    	ctx.lineWidth = line_w;
    	let pt = line_w / 2 + 3;
    
    	let k1 = 0;
    	for (let i1 = 0; i1 < n_g; i1++) {
    		ctx.strokeStyle = cl[k1];
    		ctx.fillStyle   = cl[k1];
    		a   = 0.5 * Math.PI;
    		aa  = 2.0 * Math.PI / n_p;
    		let kx1 = 0;
    		let ky1 = 0;
    		let kx2 = 0;
    		let ky2 = 0;
    		for (let i2 = 0; i2 < n_p; i2++) {
    			yy = xx + (cr - xx) * (data_y[i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]);
    			let kx = cxx + Math.round(yy * Math.cos(a));
    			let ky = cyy - Math.round(yy * Math.sin(a));
    			if (line_m) {
    				ctx.beginPath();
    				ctx.arc(kx, ky, pt, 0, 2*Math.PI, false);
    				ctx.fill();
    			}
    			if (i2 == 0) {
    				kx2 = kx;
    				ky2 = ky;
    			}
    			else {
    				ctx.beginPath();
    				ctx.moveTo(kx1, ky1);
    				ctx.lineTo(kx, ky);
    				ctx.stroke();
    				if (i2 == n_p-1) {
    					ctx.beginPath();
    					ctx.moveTo(kx2, ky2);
    					ctx.lineTo(kx, ky);
    					ctx.stroke();
    				}
    			}
    			kx1  = kx;
    			ky1  = ky;
    			a   += aa;
    		}
    		k1++;
    		if (k1 > 9)
    			k1 = 0;
    	}
    	ctx.lineWidth = 1;
    }
    
    /****************************/
    /* ボード線図の描画         */
    /*      coded by Y.Suganuma */
    /****************************/
    function Bode()
    {
    	let tx = new Array();
    					//
    					// 描画領域の設定
    					//
    	ctx.fillStyle  = 'rgb(255, 255, 255)';
    	ctx.fillRect(10, 10, canvas.width-20, canvas.height-20);
    	let x_l = 15;
    	let x_r = canvas.width - 15;
    	let y_u = 15;
    	let y_d = canvas.height - 15;
    					//
    					// グラフタイトルの表示
    					//
    	let r      = 0.05;   // タイトル領域の割合
    	let f_size = ((y_d - y_u) < (x_r - x_l)) ? Math.floor((y_d - y_u) * r) : Math.floor((x_r - x_l) * r);
    	if (f_size < 5)
    		f_size = 5;
    	if (d_t) {
    		ctx.fillStyle  = 'rgb(0, 0, 0)';
    		ctx.font = f_size + "px 'MS ゴシック'";
    		let met = ctx.measureText(title[0]);
    		let px  = (x_l + x_r) / 2 - met.width / 2;
    		let py  = y_d;
    		ctx.fillText(title[0], px, py);
    		y_d -= f_size;
    	}
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font = f_size + "px 'MS ゴシック'";
    					//
    					// 表示切り替えボタンの設置
    					//
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font = f_size + "px 'MS ゴシック'";
    	let met = ctx.measureText(change);
    	cx  = x_r - met.width - 5;
    	cy  = y_u;
    	cw  = met.width + 5;
    	ch  = f_size + 5;
    	ctx.fillStyle  = 'rgb(255, 215, 0)';
    	ctx.fillRect(cx, cy, cw, ch);
    	ctx.fillStyle  = 'rgb(0, 0, 0)';
    	let px = cx + 2;
    	let py = cy + f_size;
    	ctx.fillText(change, px, py);
    					//
    					// 凡例の表示
    					//
    	if (d_g) {
    		let han = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			let met = ctx.measureText(g_title[i1]);
    			if (met.width > han)
    				han = met.width;
    		}
    		han += 15;
    		r    = 0.2;   // 凡例領域の割合
    		let k1 = Math.floor((x_r - x_l) * r);
    		if (han > k1)
    			han = k1;
    		let kx = x_r - han;
    		let ky = y_u + 2 * f_size;
    		let k  = 0;
    		for (let i1 = 0; i1 < n_g; i1++) {
    			ctx.fillStyle  = cl[k];
    			ctx.fillRect(kx, ky-1, 10, 7);
    			ctx.fillStyle  = 'rgb(0, 0, 0)';
    			ctx.fillText(g_title[i1], kx+15, ky+2*f_size/5);
    			k++;
    			if (k > 9)
    				k = 0;
    			ky += (f_size + 5);
    		}
    		x_r -= (han + 10);
    	}
    	else
    		x_r -= Math.floor(0.03 * (x_r - x_l));
    					//
    					// x軸の対数
    					//
    	x_scale_org = x_scale[0];
    	xx_scale    = new Array(3);
    	xx_scale[0] = Math.log(x_scale[0]) / Math.log(10.0);
    	xx_scale[1] = Math.log(x_scale[1]) / Math.log(10.0);
    	xx_scale[2] = 1.0;
    	data_xx     = new Array(n_g);
    	for (let i1 = 0; i1 < n_g; i1++) {
    		data_xx[i1] = new Array(n_p);
    		for (let i2 = 0; i2 < n_p; i2++)
    			data_xx[i1][i2] = Math.log(data_x[i1][i2]) / Math.log(10.0);
    	}
    					//
    					// x軸及びy軸のタイトルの表示
    					//
    	ctx.fillStyle = 'rgb(0, 0, 0)';
    	if (title[1].length > 0 && title[1] != "-") {
    		let met = ctx.measureText(title[1]);
    		let px  = (x_l + x_r) / 2 - met.width / 2;
    		let py  = y_d - 5;
    		ctx.fillText(title[1], px, py);
    		y_d -= (f_size + 5);
    	}
    	else
    		y_d -= (f_size / 2 + 5);
    	if (title[2].length > 0 && title[2] != "-") {
    		let met = ctx.measureText(title[2]);
    		let px  = x_l;
    		let py  = y_u + 4 * f_size / 5;
    		ctx.fillText(title[2], px, py);
    		y_u += 4 * f_size / 5;
    	}
    					//
    					// x軸,y軸,及び,各軸の目盛り
    					//
    	ctx.lineWidth   = 1;
    	ctx.strokeStyle = "rgb(0, 0, 0)";
    	f_size = Math.floor(0.8 * f_size);
    	if (f_size < 5)
    		f_size = 5;
    	ctx.font  = f_size + "px 'MS 明朝'";
    	y_d     -= 5 * f_size / 4;
    	y_u     += 10;
    	x_l     += f_size;
    							// y軸
    	let k_y = Math.floor((y_scale[1] - y_scale[0]) / (0.99 * y_scale[2]));
    	let y1  = y_scale[0];
    	let len = 0;
    	let b   = Math.pow(10, place_y);
    	for (let i1 = 0; i1 < k_y+1; i1++) {
    		let yy = Math.round(y1 * b).toString();
    		if (place_y == 0)
    			tx[i1] = yy;
    		else {
    			if (yy.length < place_y+1) {
    				let n = place_y + 1 - yy.length;
    				for (let i2 = 0; i2 < n; i2++)
    					yy = "0" + yy;
    			}
    			tx[i1] = yy.substr(0,yy.length-place_y) + "." + yy.substr(yy.length-place_y,place_y);
    		}
    		let met = ctx.measureText(tx[i1]);
    		if (met.width > len)
    			len = met.width;
    		y1 += y_scale[2];
    	}
    	ctx.moveTo(x_l+len+5, y_u);
    	ctx.lineTo(x_l+len+5, y_d);
    	ctx.moveTo(x_r, y_u);
    	ctx.lineTo(x_r, y_d);
    	ctx.stroke();
    	y1 = y_scale[0];
    	let x1 = y_d;
    	let sp = (y_d - y_u) / k_y;
    	for (let i1 = 0; i1 < k_y+1; i1++) {
    		let ky  = Math.round(x1);
    		let met = ctx.measureText(tx[i1]);
    		let k1  = met.width;
    		let px  = x_l + len - k1;
    		let py  = ky + 3 * f_size / 10;
    		ctx.fillText(tx[i1], px, py);
    		ctx.moveTo(x_l+len+5, ky);
    		ctx.lineTo(x_r, ky);
    		ctx.stroke();
    		y1 += y_scale[2];
    		x1 -= sp;
    	}
    	x_l += (len + 5);
    							// x軸
    	let k_x = Math.floor((xx_scale[1] - xx_scale[0]) / (0.99 * xx_scale[2]));
    	x1  = x_scale_org;
    	sp  = (x_r - x_l) / k_x;
    	y1 = x_l;
    	b  = Math.pow(10, place_x);
    	for (let i1 = 0; i1 < k_x+1; i1++) {
    		let kx = Math.round(y1);
    		let yy = Math.round(x1 * b).toString();
    		if (place_x == 0)
    			tx[i1] = yy;
    		else {
    			if (yy.length < place_x+1) {
    				let n = place_x + 1 - yy.length;
    				for (let i2 = 0; i2 < n; i2++)
    					yy = "0" + yy;
    			}
    			tx[i1] = yy.substr(0,yy.length-place_x) + "." + yy.substr(yy.length-place_x,place_x);
    		}
    		let met = ctx.measureText(tx[i1]);
    		let k1  = met.width;
    		let px  = kx - k1 / 2;
    		let py  = y_d + f_size + 3;
    		ctx.fillText(tx[i1], px, py);
    		ctx.moveTo(kx, y_d);
    		ctx.lineTo(kx, y_u);
    		ctx.stroke();
    		if (i1 != k_x) {
    			ctx.beginPath();
    			ctx.strokeStyle = 'rgb(128, 128, 128)';
    			for (let i2 = 2; i2 <= 9; i2++) {
    				let y2 = Math.log(x1 * i2) / Math.log(10.0);
    				let kx = x_l + Math.round(((x_r - x_l) * (y2 - xx_scale[0]) / (xx_scale[1] - xx_scale[0])));
    				ctx.moveTo(kx, y_d);
    				ctx.lineTo(kx, y_u);
    				ctx.stroke();
    			}
    			ctx.beginPath();
    			ctx.strokeStyle = 'rgb(0, 0, 0)';
    		}
    		x1 *= 10.0;
    		y1 += sp;
    	}
    					//
    					// グラフの表示
    					//
    	ctx.lineWidth = line_w;
    	let k1 = 0;
    	for (let i1 = 0; i1 < n_g; i1++) {
    		ctx.beginPath();
    		ctx.strokeStyle = cl[k1];
    		let kx1 = 0;
    		let ky1 = 0;
    		for (let i2 = 0; i2 < n_p; i2++) {
    			let kx = x_l + Math.floor((x_r - x_l) * (data_xx[i1][i2] - xx_scale[0]) / (xx_scale[1] - xx_scale[0]));
    			let ky = y_d - Math.floor((y_d - y_u) * (data_y[i1][i2] - y_scale[0]) / (y_scale[1] - y_scale[0]));
    			if (i2 > 0) {
    				ctx.moveTo(kx1, ky1);
    				ctx.lineTo(kx, ky);
    				ctx.stroke();
    			}
    			kx1 = kx;
    			ky1 = ky;
    		}
    		k1++;
    		if (k1 >= cl.length)
    			k1 = 0;
    	}
    }
    
    /**********************************/
    /* 表示の切り替えボタンのクリック */
    /**********************************/
    function Click(event)
    {
    	let x_now;
    	let y_now;
    	if (navigator.appName.indexOf("Explorer") >= 0) {
    		x_now = event.x - x_base;
    		y_now = event.y - y_base;
    	}
    	else {
    		x_now = event.pageX - x_base;
    		y_now = event.pageY - y_base;
    	}
    					// 縦表示,横表示の変更
    	if (kind <= 3 && x_now > cx && x_now < cx+cw/2 && y_now > cy && y_now < cy+ch) {
    		if (ver) {
    			ver    = false;
    			change = "縦 色";
    		}
    		else {
    			ver    = true;
    			change = "横 色";
    		}
    
    		ctx.beginPath();
    		ctx.clearRect(0, 0, canvas.width, canvas.height);
    
    		if (kind == 0)
    			BarGraph();
    		else if (kind == 1)
    			LineGraph1();
    		else if (kind == 2)
    			LineGraph2();
    		else
    			StackGraph();
    	}
    					// 色や線の太さの変更
    	else if (kind <= 3 && x_now > cx+cw/2 && x_now < cx+cw && y_now > cy && y_now < cy+ch ||
                 (kind == 4 || kind >= 6) && x_now > cx && x_now < cx+cw && y_now > cy && y_now < cy+ch) {
    		let n = n_g;
    		if (kind == 3 || kind == 4)
    			n = n_p;
    		if (n > 10)
    			n = 10;
    		document.getElementById('cl_line').style.display = "";
    		for (let i1 = 0; i1 < n; i1++) {
    			let id = "c" + i1;
    			document.getElementById(id).style.display = "";
    		}
    		for (let i1 = n; i1 < 10; i1++) {
    			let id = "c" + i1;
    			document.getElementById(id).style.display = "none";
    		}
    		if (kind == 1 || kind == 2 || kind == 6 || kind == 7)
    			document.getElementById('line_w').style.display = "";
    		else
    			document.getElementById('line_w').style.display = "none";
    		if (kind == 1 || kind == 2 || kind == 6)
    			document.getElementById('line_m').style.display = "";
    		else
    			document.getElementById('line_m').style.display = "none";
    	}
    }
    
    /********************************************************/
    /* 「OK」ボタンがクリックされたとき(線の太さ等の設定) */
    /********************************************************/
    function D_Change()
    {
    					// 線の太さ
    	if (kind == 1 || kind == 2 || kind == 6 || kind == 7)
    		line_w = parseInt(document.getElementById('l_w').value);
    					// マーク
    	if (kind == 1 || kind == 2 || kind == 6)
    		line_m = document.getElementById('l_m1').checked ? true : false;
    					// 再描画
    	document.getElementById('cl_line').style.display = "none";
    	graph(gpp);
    }
    
    /******************************************/
    /* TextField が変更されたとき(色の変更) */
    /******************************************/
    function c_change(sw)
    {
    	let rgb1 = "rgb(";
    	let str = "r" + sw;
    	let r1 = document.getElementById(str).value;
    	if (r1 == "")
    		r1 = "0";
    	rgb1 = rgb1 + r1 + ",";
    	str = "g" + sw;
    	let g1 = document.getElementById(str).value;
    	if (g1 == "")
    		g1 = "0";
    	rgb1 = rgb1 + g1 + ",";
    	str = "b" + sw;
    	let b1 = document.getElementById(str).value;
    	if (b1 == "")
    		b1 = "0";
    	rgb1 = rgb1 + b1 + ")";
    	cl[sw] = rgb1;
    	clr[sw] = r1;
    	clg[sw] = g1;
    	clb[sw] = b1;
    	str = "rgb" + sw;
    	document.getElementById(str).style.backgroundColor = cl[sw];
    }
    			

情報学部 菅沼ホーム 目次 索引