void VisScatterDiagTwoDim::DrawScatters(){
	int data_size =  getDataSize();

	int shape = visScatter->getShapeType();
	int size = visScatter->getPointSize();


	std::vector<double> data(data_size);

	int width, height;
	width = XmdvTool::SUBWIN_WIDTH;
	height = XmdvTool::SUBWIN_HEIGHT;
	double radiusW = (double)size/(4.0*width);
	double radiusH = (double)size/(4.0*height);

	std::vector<double> dim_min = visScatter->m_dim_min;
	std::vector<double> dim_max = visScatter->m_dim_max;
	CalculateRowsColumns();

	OkcData* okcdata = visScatter->getDisplayDataset();
	OkcDataModifierManager* okcDataModifierManager = okcdata->getOkcDataModifierManager();
	OkcVisualMapResult* okcVMR = visScatter->getOkcVisualMapResult();
	GLCanvas* canvas = GetCanvas();

	std::vector<int> temp_buf, buf;
	int all_dims = okcdata->getOrigDimSize();
	temp_buf.resize(all_dims);
	for(int i=0; i<all_dims; i++){
		temp_buf[i] = i;
	}

	okcDataModifierManager->mapData(temp_buf, buf);
	int dim_size = buf.size();

	for (int k = 0; k < dim_size; k++) {
		int i = buf[k];
		okcdata->GetDimensionData(data, i);

		double x1, y1;
		for (int j = 0; j < data_size; j++) {
			VisualAttribute* curAttr = okcVMR->getDiagMultiDimDataVisAttr(i, j);

			canvas->setForeground(curAttr->color);

			x1 = XOrderMAP(k, (j % columns));
			y1 = YOrderMAP(k, (j / columns));

			if (shape == 0) {
				glBegin(GL_POINTS);
				glPointSize((float) size);
				glVertex2f(x1, y1);
				glEnd();
			} else if (shape == 1) {
				canvas->drawCircle(x1, y1, radiusW, radiusH);
			}
		}
	}
}
void VisScatterDiagTwoDimDerived::DrawScatters() {
    OkcDataModifierPCADerive* mod = getModifierPCA();

    int data_size = getDataSize();

    int cox = this->visScatter->getDerivedXDimNumber();
    int coy = this->visScatter->getDerivedYDimNumber();

    std::vector<double> data(data_size);

    std::vector<double> locationx(data_size);
    std::vector<double> locationy(data_size);

    std::vector<double> dim_min = visScatter->m_dim_min;
    std::vector<double> dim_max = visScatter->m_dim_max;


    OkcData* okcdata = visScatter->getDisplayDataset();
    OkcVisualMapResult* okcVMR = visScatter->getOkcVisualMapResult();
    GLCanvas* canvas = GetCanvas();

    std::vector<int> temp_buf, buf;
    int all_dims = okcdata->getOrigDimSize();
    temp_buf.resize(all_dims);
    for(int i=0; i<all_dims; i++) {
        temp_buf[i] = i;
    }
    OkcDataModifierManager* okcDataModifierManager = okcdata->getOkcDataModifierManager();
    okcDataModifierManager->mapData(temp_buf, buf);
    int dim_size = buf.size();

    if(cox>2) {
        okcdata->GetDimensionData(locationx, buf[cox-3]);
    } else {
        mod->getOneDimPrincipal(locationx, cox);
    }
    if(coy>2) {
        okcdata->GetDimensionData(locationy,  buf[coy-3]);
    } else {
        mod->getOneDimPrincipal(locationy, coy);
    }
    int shape = visScatter->getShapeType();
    int size = visScatter->getPointSize();

    int width, height;
    width = XmdvTool::SUBWIN_WIDTH;
    height = XmdvTool::SUBWIN_HEIGHT;
    double radiusW = (double) size / (4.0 * width);
    double radiusH = (double) size / (4.0 * height);


    for (int k = 0; k < dim_size; k++) {
        int i = buf[k];
        okcdata->GetDimensionData(data, i);
        double x1, y1;
        for (int j = 0; j < data_size; j++) {

            VisualAttribute* curAttr = okcVMR->getDiagMultiDimDataVisAttr(i, j);
            canvas->setForeground(curAttr->color);
            x1 = XMAP(k, cox, locationx[j]);
            y1 = YMAP(k, coy, locationy[j]);

            if (shape == 0) {
                glBegin(GL_POINTS);
                glPointSize((float) size);
                glVertex2f(x1, y1);
                glEnd();
            } else if (shape == 1) {
                canvas->drawCircle(x1, y1, radiusW, radiusH);
            }
        }
    }
}