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

📄 cfz4ct.cpp

📁 windRiver提供的的Zinc5.3完整源码,文档非常齐全
💻 CPP
字号:

//==================================================================
//
//	cfz4ct.cpp -- demonstrates a window containing four different
//				  charts, all displaying the same data
//
//==================================================================

#include <zaf.hpp>
#include <cf_api/bz_zcht.hpp>
#include <cff3_zaf.h>

const int NUM_GROUPS = 3;
const int NUM_POINTS = 15;

double DATA[NUM_GROUPS][NUM_POINTS] =
{
	{ 20, 18, 14,  2, 14, 37, 35, 30, 24, 23, 15, 32,  6,  7, 15 },
	{ 20, 15, 10, 12, 14, 20, 24, 28, 30, 32, 39, 12, 15,  6,  1 },
	{ 16, 15, 23, 17, 24, 20, 18, 13, 28, 16, 26,  5, 11, 19, 25 },
};


class ChartWindow : public ZafWindow
{
public:
    ChartWindow();
private:
	void		AddDataToChart (ZafChart*);
};





ChartWindow ::ChartWindow()
		    : ZafWindow( 10, 2, 80, 16 )
{
	AddGenericObjects (new ZafStringData ("ChartFolio for ZAF 5"));

	//
	//	Create four charts for our window
	//
	ZafChart    *area_chart;
	ZafChart    *bar_chart;
    ZafChart	*line_chart;
	ZafChart    *stack_chart;

	area_chart = new ZafChart  (  1,  8, 40,  8, CF_ID_AREA_2D);
	bar_chart = new ZafChart   ( 43,  0, 40,  8, CF_ID_BAR_2D);
    line_chart = new ZafChart  (  1,  0, 40,  8, CF_ID_LINE_2D);
    stack_chart = new ZafChart ( 43,  8, 40,  8, CF_ID_STACK_2D);

	//
	//	Add the same data set to each chart
	//
    AddDataToChart (area_chart);
    AddDataToChart (bar_chart);
    AddDataToChart (line_chart);
    AddDataToChart (stack_chart);


	//
	//	Add the charts to our window
	//
    Add (area_chart);
    Add (bar_chart);
    Add (line_chart);
    Add (stack_chart);
}






void 
ChartWindow::AddDataToChart (ZafChart* chart)
{
    for (int i = 0; i < NUM_GROUPS; i++ )
    {
    	for (int j = 0; j < NUM_POINTS; j++ )
        {
		    chart -> AddDataPoint (i + 1, DATA[i][j]);
        }
    }
}






ZafApplication::Main()
{
	ChartWindow*		win;


	zafWindowManager -> Center (win = new ChartWindow);
	zafWindowManager -> Add (win);
    Control ();
	return (0);
}





⌨️ 快捷键说明

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