⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cfxpassdata.cpp

📁 Delphi Component - Chart Fx
💻 CPP
📖 第 1 页 / 共 2 页
字号:
        
    m_pChartFX->OpenDataEx((CfxCod) (COD_VALUES|COD_REMOVE), 4, 12);
    for(i=0;i<4;i++) {
		for(j=0;j<12;j++) {
			m_pChartFX->ValueEx[i][j] = (i + 1) * 20 + (rand() % 20);
		}
    }
        
    m_pChartFX->ValueEx[OHLC_OPEN][5] = 75;
    m_pChartFX->ValueEx[OHLC_CLOSE][5] = 35;
    m_pChartFX->ValueEx[OHLC_LOW][5] = 15;
    m_pChartFX->ValueEx[OHLC_HIGH][5] = 90;
        
    m_pChartFX->CloseData(COD_VALUES);
        
    m_pChartFX->OpenDataEx(COD_COLORS, 3, 0);

	ICfxSeriesPtr pSerie;
	pSerie = m_pChartFX->Series->Item[0];

    pSerie->Color = CHART_PALETTECOLOR | 5;
    pSerie->Legend = "Positive";
        
	pSerie = m_pChartFX->Series->Item[1];
	
    pSerie->Color = CHART_PALETTECOLOR | 0;
    pSerie->Legend = "Negative";
        
	pSerie = m_pChartFX->Series->Item[2];        
        
    pSerie->Color = CHART_PALETTECOLOR | 25;
    pSerie->Legend = "High & Low Values";
        
    m_pChartFX->CloseData(COD_COLORS);
        
        
    m_pChartFX->SerLegBox = TRUE;
    m_pChartFX->SerLegBoxObj->Docked = TGFP_TOP;
    m_pChartFX->SerLegBoxObj->BorderStyle = BBS_RAISED;
        
    //to hide the secondary Y axis created in the scatter chart
    m_pChartFX->Axis->Item[AXIS_Y2]->Style = (CfxAxisStyle) (m_pChartFX->Axis->Item[AXIS_Y2]->Style | AS_HIDE);

	
}

void CCfxPassData::OnPyramid() 
{

	
	int i;

    
    //in general to remove the strings set in the other charts
    m_pChartFX->ClearData(CD_STRINGS);
    //in general to remove different settings per series in the other charts
    m_pChartFX->ClearData(CD_PERSERIESATTRIBUTES);
    //to remove the contant lines set in the bubble chart
    m_pChartFX->ClearData(CD_CONSTANTLINES);
    //in general to remove colors or patterns set in other charts
    m_pChartFX->ClearData(CD_COLORSANDPATTERNS);
    //in general to remove tools like dataeditor, legend boxes set in other charts
	m_pChartFX->ClearData(CD_TOOLS);
    //to remove the stripes set in the scatter chart
    m_pChartFX->ClearData(CD_STRIPES);
        
    m_pChartFX->Palette = "Dark Pastels";
    m_pChartFX->PaletteBar = TRUE;
        
    m_pChartFX->DataEditor = TRUE;
    m_pChartFX->DataEditorObj->Docked = TGFP_RIGHT;
        
    m_pChartFX->Gallery = PYRAMID;
        
    m_pChartFX->CylSides = 0;
    m_pChartFX->PointLabels = FALSE;
        
    m_pChartFX->OpenDataEx((CfxCod) (COD_VALUES|COD_REMOVE), 2, 10);
	for(i=0;i<10;i++) {
		m_pChartFX->ValueEx[0][i] = 10 + (rand() % 100);
        m_pChartFX->ValueEx[1][i] = 10 + (rand() % 100);
	}            
	m_pChartFX->CloseData(COD_VALUES);
    
}

void CCfxPassData::OnStep() 
{


	int i;
    //in general to remove the strings set in the other charts
    m_pChartFX->ClearData(CD_STRINGS);
    //in general to remove different settings per series in the other charts
    m_pChartFX->ClearData(CD_PERSERIESATTRIBUTES);
    //to remove the contant lines set in the bubble chart
    m_pChartFX->ClearData(CD_CONSTANTLINES);
    //in general to remove colors or patterns set in other charts
    m_pChartFX->ClearData(CD_COLORSANDPATTERNS);
    //in general to remove tools like dataeditor, legend boxes set in other charts
    m_pChartFX->ClearData(CD_TOOLS);
    //to remove the xvalues set in the scatter chart
    m_pChartFX->ClearData(CD_XVALUES);
    //to remove the stripes set in the scatter chart
    m_pChartFX->ClearData(CD_STRIPES);
    
    m_pChartFX->Palette = "light pastels";
    m_pChartFX->PaletteBar = TRUE;
    
    m_pChartFX->Gallery = STEP;
        
    m_pChartFX->PointLabels = FALSE;
    m_pChartFX->CylSides = 0;
        
    m_pChartFX->Axis->Item[AXIS_X]->ResetScale();
    m_pChartFX->Axis->Item[AXIS_Y]->ResetScale();
        
    m_pChartFX->OpenDataEx((CfxCod) (COD_VALUES|COD_REMOVE), 2, 10);
	for(i=0;i<10;i++) {
		m_pChartFX->ValueEx[0][i] = rand() % 50;
        m_pChartFX->ValueEx[1][i] = 50 + rand() % 50;
	}         
    m_pChartFX->CloseData(COD_VALUES);
    
    m_pChartFX->OpenDataEx(COD_COLORS, 2, 0);
    m_pChartFX->Series->Item[0]->Color = CHART_PALETTECOLOR | 44;
    m_pChartFX->Series->Item[1]->Color = CHART_PALETTECOLOR | 45;
    m_pChartFX->CloseData(COD_COLORS);
    
    m_pChartFX->Axis->Item[AXIS_Y]->Grid = TRUE;
    m_pChartFX->Axis->Item[AXIS_Y]->Style = (CfxAxisStyle) (m_pChartFX->Axis->Item[AXIS_Y]->Style | AS_INTERLACED);
    
    //to hide the secondary Y axis created in the scatter chart
    m_pChartFX->Axis->Item[AXIS_Y2]->Style = (CfxAxisStyle) (m_pChartFX->Axis->Item[AXIS_Y2]->Style | AS_HIDE);
    
    m_pChartFX->SerLegBox = TRUE;
	ICfxLegendBoxPtr pSerLegBoxObj;
    pSerLegBoxObj = m_pChartFX->SerLegBoxObj;
    pSerLegBoxObj->Docked = TGFP_FLOAT;
    pSerLegBoxObj->Left = 0;
    pSerLegBoxObj->Top = 0;
    
    
}

void CCfxPassData::OnDoughnut() 
{

	int i;

    //in general to remove the strings set in the other charts
    m_pChartFX->ClearData(CD_STRINGS);
    //in general to remove different settings per series in the other charts
    m_pChartFX->ClearData(CD_PERSERIESATTRIBUTES);
    //to remove the contant lines set in the bubble chart
    m_pChartFX->ClearData(CD_CONSTANTLINES);
    //in general to remove colors or patterns set in other charts
    m_pChartFX->ClearData(CD_COLORSANDPATTERNS);
    //in general to remove tools like dataeditor, legend boxes set in other charts
    m_pChartFX->ClearData(CD_TOOLS);
    //to remove the stripes set in the scatter chart
    m_pChartFX->ClearData(CD_STRIPES);
    
    m_pChartFX->Palette = "nature";
    m_pChartFX->PaletteBar = TRUE;
    
    m_pChartFX->Gallery = DOUGHNUT;
        
    m_pChartFX->PointLabels = TRUE;
    m_pChartFX->SeparateSlice[-1] = 0;
    m_pChartFX->CylSides = 0;
        
    m_pChartFX->OpenDataEx((CfxCod) (COD_VALUES|COD_REMOVE), 1, 5);
    m_pChartFX->OpenDataEx(COD_COLORS, 5, 0);

	SYSTEMTIME t;
	char buffer[50];

	t.wYear = 1998;
	t.wMonth = 8;
	t.wDay = 5;

    for(i=0;i<5;i++) {
		m_pChartFX->ValueEx[0][i] = 100 + rand() % 100;
		t.wDay = t.wDay + 1;
		GetDateFormat(NULL, NULL, &t, NULL, buffer,50); 
        m_pChartFX->Legend[i] = buffer;
        m_pChartFX->Color[i] = CHART_PALETTECOLOR | (rand() % 40);
    }
    m_pChartFX->CloseData(COD_VALUES);
    m_pChartFX->CloseData(COD_COLORS);
    
	
}

void CCfxPassData::OnScatter() 
{



	int i;
    //in general to remove the strings set in the other charts
    m_pChartFX->ClearData(CD_STRINGS);
    //in general to remove different settings per series in the other charts
    m_pChartFX->ClearData(CD_PERSERIESATTRIBUTES);
    //to remove the contant lines set in the bubble chart
    m_pChartFX->ClearData(CD_CONSTANTLINES);
    //in general to remove colors or patterns set in other charts
    m_pChartFX->ClearData(CD_COLORSANDPATTERNS);
    //in general to remove tools like dataeditor, legend boxes set in other charts
    m_pChartFX->ClearData(CD_TOOLS);
    
    m_pChartFX->Palette = "fall";
    m_pChartFX->PaletteBar = TRUE;
    
    m_pChartFX->Gallery = SCATTER;
    
    m_pChartFX->PointLabels = FALSE;
    
    m_pChartFX->Axis->Item[AXIS_Y]->Grid = FALSE;
    
    m_pChartFX->Axis->Item[AXIS_X]->ResetScale();
    m_pChartFX->Axis->Item[AXIS_Y]->ResetScale();
        
        
    m_pChartFX->OpenDataEx((CfxCod) (COD_VALUES|COD_REMOVE), 2, 10);
    m_pChartFX->OpenDataEx(COD_XVALUES, 2, 10);
    
    m_pChartFX->Series->Item[0]->YAxis = AXIS_Y;
    m_pChartFX->Series->Item[1]->YAxis = AXIS_Y2;
    
    for(i=0;i<10;i++) {
        m_pChartFX->ValueEx[0][i] = rand() % 100;
        m_pChartFX->XValueEx[0][i] = rand() % 100;
        
        m_pChartFX->ValueEx[1][i] = rand() % 1000;
        m_pChartFX->XValueEx[1][i] = rand() % 100;
    }
    m_pChartFX->CloseData(COD_VALUES);
    m_pChartFX->CloseData(COD_XVALUES);
    
    m_pChartFX->MarkerSize = 4;
	ICfxAxisPtr pAxis;
	pAxis = m_pChartFX->Axis->Item[AXIS_X];
    
    pAxis->Min = 0;
    pAxis->Max = 100;
    pAxis->STEP = 10;
    pAxis->MinorStep = 2;
    
	pAxis = m_pChartFX->Axis->Item[AXIS_Y2];
    
    pAxis->Min = 0;
    pAxis->Max = 1000;
    pAxis->STEP = 100;
    
	pAxis = m_pChartFX->Axis->Item[AXIS_Y];
    
    pAxis->Min = 0;
    pAxis->Max = 100;
    pAxis->STEP = 10;
    
    
    m_pChartFX->OpenDataEx(COD_COLORS, 2, 0);
    m_pChartFX->Series->Item[0]->Color = CHART_PALETTECOLOR | 47;
    m_pChartFX->Series->Item[1]->Color = CHART_PALETTECOLOR | 45;
    m_pChartFX->CloseData(COD_COLORS);
    /*
    m_pChartFX->OpenDataEx(COD_STRIPES, 3, 0);
	ICfxStripePtr pStripe;
	pStripe = m_pChartFX->Stripe->Item[0];
    
    pStripe->Axis = AXIS_Y;
    pStripe->Color = CHART_PALETTECOLOR | 2;
    pStripe->From = 0;
    pStripe->To = 30;
    
	pStripe = m_pChartFX->Stripe->Item[1];
    
    pStripe->Axis = AXIS_Y;
    pStripe->Color = CHART_PALETTECOLOR | 5;
    pStripe->From = 30;
    pStripe->To = 70;
    
	pStripe = m_pChartFX->Stripe->Item[2];
    
    pStripe->Axis = AXIS_Y;
    pStripe->Color = CHART_PALETTECOLOR | 2;
    pStripe->From = 70;
    pStripe->To = 100;
    
    m_pChartFX->CloseData(COD_STRIPES);
 	*/
}

void CCfxPassData::OnRadar() 
{



	int i;

    //in general to remove the strings set in the other charts
    m_pChartFX->ClearData(CD_STRINGS);
    //in general to remove different settings per series in the other charts
    m_pChartFX->ClearData(CD_PERSERIESATTRIBUTES);
    //to remove the contant lines set in the bubble chart
    m_pChartFX->ClearData(CD_CONSTANTLINES);
    //in general to remove colors or patterns set in other charts
    m_pChartFX->ClearData(CD_COLORSANDPATTERNS);
    //in general to remove tools like dataeditor, legend boxes set in other charts
    m_pChartFX->ClearData(CD_TOOLS);
    //to remove the stripes set in the scatter chart
    m_pChartFX->ClearData(CD_STRIPES);
    //to remove the xvalues set in the scatter chart
    m_pChartFX->ClearData(CD_XVALUES);
    
    m_pChartFX->Palette = "";
    m_pChartFX->PaletteBar = TRUE;
    
    m_pChartFX->Gallery = RADAR;
    
    m_pChartFX->PointLabels = FALSE;
    m_pChartFX->MarkerSize = 2;
    
    m_pChartFX->Axis->Item[AXIS_X]->ResetScale();
    m_pChartFX->Axis->Item[AXIS_Y]->ResetScale();
    
    m_pChartFX->OpenDataEx((CfxCod) (COD_VALUES|COD_REMOVE), 2, 10);
    
    for(i=0;i<10;i++) {
        m_pChartFX->ValueEx[0][i] = rand() % 100;
        m_pChartFX->ValueEx[1][i] = rand() % 100;
    
    }
    m_pChartFX->CloseData(COD_VALUES);
    
	ICfxAxisPtr pAxis;
	pAxis = m_pChartFX->Axis->Item[AXIS_Y];

    
    pAxis->Grid = TRUE;
    pAxis->GridStyle = CHART_SOLID;
    
    
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -