public NslAreaCanvas(NslFrame nslDisplayFrame, NslCanvas pre) {
   this(
       nslDisplayFrame,
       pre.canvas_name,
       ((NslVariable) pre.variable_list.elementAt(0)).info,
       pre.getC_min_y(),
       pre.getC_max_y());
 }
  public void paint_partial(Graphics g) {

    if (canvas_type.equals("Normal")) {
      super.set_draw_size();
    } else if (canvas_type.equals("Zoom")) {
      super.zoom_draw_size();
    }

    g.setColor(Color.black);

    // draw variable

    NslVariable v = (NslVariable) variable_list.elementAt(0);
    x_dimension = v.info.getDimension(0);
    y_dimension = v.info.getDimension(1);

    last_data_pos = ((NslVariable) variable_list.elementAt(0)).last_data_pos;
    data = ((NslVariable) variable_list.elementAt(0)).data;

    if ((NslSystem.init_run_char == 'B') || (NslSystem.init_run_char == 'D')) { // before or during
      // System.out.println("debug: NslAreaCanvas bad flag "+ NslSystem.init_run_char);
      // NslSystem.init_run_char = 'B';
      last_data_pos = 0;
    }

    draw_time = last_data_pos;

    // NslStoringVariables Bez = new NslStoringVariables();
    // for( ; draw_time<=last_data_pos; draw_time++){

    // System.out.println("\n\n\nDRAWTIME = "+draw_time );

    /*
    	//  if (draw_time > 0 && (draw_time % 30 == 0))
    		//fitting_main(draw_time); // just for testing purposes
    //		Bez.fitting_main(draw_time); // just for testing purposes
    */

    for (int i = 0; i < x_dimension; i++)
      for (int j = 0; j < y_dimension; j++) {

        Color color = getBackground();
        g.setColor(color);

        g.fillRect(drawX + j * dx + 1, drawY + i * dy + 1, dx - 1, dy - 1);

        // to draw multiple variables

        for (int v_count = 0; v_count < variable_list.size(); v_count++) {

          data = ((NslVariable) variable_list.elementAt(v_count)).data;

          if (data[i][j][draw_time] >= y_max) {
            data_x_size = dx;
            data_y_size = dy;
          } else if (data[i][j][draw_time] <= y_min) {
            data_x_size = dx; // (int)y_min;
            data_y_size = dy; // (int)y_min;
          } else {
            // data_x_size = (int)(dx * (Math.abs(data[i][j][draw_time] - y_min) / (y_max -
            // y_min)));
            // data_y_size = (int)(dy * (Math.abs(data[i][j][draw_time] - y_min) / (y_max -
            // y_min)));
            double scale = 0;
            if (data[i][j][draw_time] >= 0) scale = data[i][j][draw_time] / y_max;
            else scale = data[i][j][draw_time] / y_min;

            data_x_size = (int) (dx * scale);
            data_y_size = (int) (dy * scale);
          }

          boxColor = ((NslVariable) variable_list.elementAt(v_count)).info.getColor();
          g.setColor(boxColor);

          // ERH g.setXORMode(getBackground());  // For overlaying the multiple box

          if (data[i][j][draw_time] == 0) {
            g.fillRect(drawX + j * dx + dx / 2, drawY + i * dy + dy / 2, 1, 1);
          } else if (data[i][j][draw_time] > 0) {
            // System.out.println("Filling rectangle " + data_x_size+" "+data[i][j][draw_time]);
            g.fillRect(
                drawX + j * dx + (dx - data_x_size) / 2,
                drawY + i * dy + (dy - data_y_size) / 2,
                data_x_size,
                data_y_size);
          } else {
            // System.out.println(" Drawing rectangle " + data_x_size+" "+data[i][j][draw_time]);
            g.drawRect(
                drawX + j * dx + (dx - data_x_size) / 2 + 1,
                drawY + i * dy + (dy - data_y_size) / 2 + 1,
                data_x_size - 2,
                data_y_size - 2);
          }
          g.setPaintMode();
        }
      }
    // }
    super.paint(g, 1);
  }
 public void set_y_range(float ymin, float ymax) {
   y_min = ymin;
   y_max = ymax;
   super.set_min_max((double) ymin, (double) ymax);
 }