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

📄 cfxlinesstripes.cpp

📁 Delphi Component - Chart Fx
💻 CPP
字号:
// CfxLinesStripes.cpp : implementation file
//

#include "stdafx.h"
#include "Cfx98.h"
#include "CfxLinesStripes.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CCfxLinesStripes dialog


CCfxLinesStripes::CCfxLinesStripes(CWnd* pParent /*=NULL*/)
	: CDialog(CCfxLinesStripes::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCfxLinesStripes)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CCfxLinesStripes::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCfxLinesStripes)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP

	// ***CFX***
	// Do not use class wizard to generate these. It will cause the generation of unecesary classes
	DDX_Control(pDX, IDC_CHART1, m_ChartFX);
	if (!pDX->m_bSaveAndValidate) // Link Chart FX pointer to control window
		m_pChartFX = m_ChartFX.GetControlUnknown();
	// ***CFX***

}


BEGIN_MESSAGE_MAP(CCfxLinesStripes, CDialog)
	//{{AFX_MSG_MAP(CCfxLinesStripes)
	ON_BN_CLICKED(IDC_CONSTANTLINES, OnConstantlines)
	ON_BN_CLICKED(IDC_STRIPES, OnStripes)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCfxLinesStripes message handlers

BOOL CCfxLinesStripes::DestroyWindow() 
{
	// TODO: Add your specialized code here and/or call the base class

	m_pChartFX = NULL;
	
	return CDialog::DestroyWindow();
}

void CCfxLinesStripes::OnConstantlines() 
{
	// TODO: Add your control notification handler code here
	ICfxConstPtr pConst;
    //create 3 constant lines
    m_pChartFX->OpenDataEx(COD_CONSTANTS, 3, 0);
	
	pConst = m_pChartFX->ConstantLine->Item[0];

	pConst->Value = 70;
    pConst->Axis = AXIS_Y; //horizontal
    pConst->Label = "Average 2";
    //set the label of the constant line to be aligned to the right
    pConst->Style = (CfxConstType) (pConst->Style | CC_RIGHTALIGNED);
    pConst->LineColor = RGB(255, 0, 0);
    pConst->LineStyle = CHART_DASH;
    pConst->LineWidth = 2;
 	
	pConst = m_pChartFX->ConstantLine->Item[1];

    pConst->Value = 30;
    pConst->Axis = AXIS_Y; //horizontal
    pConst->Label = "Average 1";
    //set the label of the constant line to be aligned to the right
    pConst->Style = (CfxConstType) (pConst->Style | CC_RIGHTALIGNED);
    pConst->LineColor = RGB(255, 0, 0);
    pConst->LineStyle = CHART_DASH;
    pConst->LineWidth = 2;
    	
	pConst = m_pChartFX->ConstantLine->Item[2];

    pConst->Value = 5;
    pConst->Axis = AXIS_X; //vertical
    pConst->Label = "Check Point";
    pConst->LineColor = RGB(0, 0, 255);
    pConst->LineStyle = CHART_DOT;
    pConst->LineWidth = 1;

    m_pChartFX->CloseData(COD_CONSTANTS);
    
    //assign font properties for the text labels of the constant lines
    m_pChartFX->Fonts[(CfxFont) CHART_FIXEDFT] = (CfxFontAttr) (CF_BOLD | CF_ARIAL | 12);
    //assign text color for the labels of the constant lines
    m_pChartFX->RGBFont[(CfxFont) CHART_FIXEDFT] = RGB(0, 128, 128);
    
	
}

void CCfxLinesStripes::OnStripes() 
{
	// TODO: Add your control notification handler code here

	ICfxStripePtr pStripe;

    m_pChartFX->OpenDataEx(COD_STRIPES, 3, 0);
    
	pStripe = m_pChartFX->Stripe->Item[0];

    
    pStripe->Axis = AXIS_Y;
    pStripe->From = 10;
    pStripe->To = 30;
    pStripe->Color = CHART_PALETTECOLOR | 2;
    
    
	pStripe = m_pChartFX->Stripe->Item[1];

    
    pStripe->Axis = AXIS_Y;
    pStripe->From = 40;
    pStripe->To = 50;
    pStripe->Color = CHART_PALETTECOLOR | 9;
    
    pStripe = m_pChartFX->Stripe->Item[2];

    
    pStripe->Axis = AXIS_Y;
    pStripe->From = 60;
    pStripe->To = 90;
    pStripe->Color = CHART_PALETTECOLOR | 41;

    m_pChartFX->CloseData(COD_STRIPES);

}

⌨️ 快捷键说明

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