Graphics In Form

本文介绍了一种在表单中使用ActiveX控件绘制堆叠图表的方法。通过定义`showGraphics`方法,利用`AAATestGraphics`数据源进行图表数据加载,并展示了如何设置图表属性和显示图表。

Add a method in Graphics(Class)

 

void parmStacked(int _stacked = 0)
{
    ;
    chartFXCtrl.stacked(_stacked);

}

 

Add a ActiveX(Chart Object) in a Form and set name="MyGraphics" and Add a method in Form

and override TablePage method : pageActivated(element.showGraphics())

void showGraphics()
{
    AAATestGraphics       TestGraphics;
    Integer     mark;
    Integer     x;

    str         s;
    str         strPeriod;
    str         strKey;
    str         strBase;

    Map         mapPeriod   = new Map(Types::String,Types::String);
    Map         mapKey      = new Map(Types::String,Types::String);
    Map         mapBase     = new Map(Types::String,Types::Real);

    MapIterator mi;
    ;

    if (graphics)
        graphics.closeGraph();

    graphics = Graphics::newGraphicsNoTitles(Mygraphics,Mygraphics.widthValue() ? Mygraphics.widthValue() : 700,Mygraphics.heightValue() ? Mygraphics.heightValue() : 400);

    TestGraphics = AAATestGraphics_ds.getFirst(1,false);
    mark = 0;
//    mark = 1;

    graphics.resetGraph();
    graphics.parmStacked(1);
    TestGraphics = AAATestGraphics_ds.getFirst(mark,true);
    while (TestGraphics)
    {
        x++;

        strPeriod   = TestGraphics.Month;
        strKey      = TestGraphics.Type;
        strBase     = num2str(TestGraphics.Value,1,2,1,0);

        if ( ! strPeriod && ! strKey && ! strBase)
            break;

        s =strPeriod+'#'+strKey+'#'+strBase+'#'+int2str(x);

        mapPeriod.insert(s,strPeriod);
        mapKey.insert(s,strKey);
        mapBase.insert(s,TestGraphics.Value);

        TestGraphics = AAATestGraphics_ds.getNext();
    }

    mi = new MapIterator(mapPeriod);
    mi.begin();
    while (mi.more())
    {
        strPeriod   = mapPeriod.lookup(mi.key()) ? mapPeriod.lookup(mi.key())   : '\'\'';
        strKey      = mapKey.lookup(mi.key())    ? mapKey.lookup(mi.key())      : '\'\'';

        graphics.loadData(strPeriod,strKey,mapBase.lookup(mi.key()));

        mi.next();
    }

    graphics.showGraph();
}

 

 

 

转载于:https://www.cnblogs.com/lingdanglfw/archive/2008/09/02/1282136.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值