aardio调用ChartDirector实现饼状图表功能示例
By
admin
at 2021-04-11 • 1人收藏 • 1157人看过
ChartDirector是著名的商业图表, 包含有以下功能:
可以免费下载使用, 但是免费版底部会有一个黄色的版权条.
这里演示下饼状图表的aardio中调用简单例子:(这里是在文件目录生成一个图表图片)
import win.ui; /*DSG{{*/ mainForm = win.form(text="aardio工程6";right=690;bottom=428) mainForm.add() /*}}*/ var dll = ..raw.loadDll("\res\chartdir60.dll",,"cdecl"); CPieChart_create = dll.api("CPieChart_create","pointer(int,int,int,int,int)" ); PieChart2BaseChart = dll.api("PieChart2BaseChart","pointer(pointer)" ); CPieChart_setPieSize = dll.api("CPieChart_setPieSize","void(pointer,int,int,int)" ) CPieChart_set3D = dll.api("CPieChart_set3D","void(pointer,int,double,bool)" ) CPieChart_setExplode = dll.api("CPieChart_setExplode","void(pointer,int,int)" ) CBaseChart_addTitle = dll.api("CBaseChart_addTitle","pointer(pointer,string,string,double,int,int,int)" ) CBaseChart_makeChart = dll.api("CBaseChart_makeChart","bool(pointer,string)" ) CPieChart_setData = dll.api("CPieChart_setData","void(pointer,pointer,int,pointer,int)" ) var paichart =CPieChart_create(280, 240,0xffffff,0,0); var chart = PieChart2BaseChart(paichart); CPieChart_setPieSize(paichart,140, 130, 80); CBaseChart_addTitle(chart,"aardio-ChartDirector-demo","bold",12,0,0xffffff,0); CPieChart_set3D(paichart,-1,-1,false); var buff1 = raw.buffer({double data[7]={45, 18, 15, 12, 8, 30, 25}}); var buff2 = raw.buffer({string data[7]={"aardio", "c#", ".net", "reby", "labview", "html","php"}}); CPieChart_setData(paichart,buff1,7,buff2,7); CPieChart_setExplode(paichart,0,-1); CBaseChart_makeChart(chart,"demo.png"); mainForm.show(); return win.loopMessage();
其他功能类似, 不过看c++的示例需要把类库自己翻译过来.
注意看上面的代码中, 有CPieChart和CBaseChart开头, 它们分别对应操作不同的对象,所以后面的参数里第一个参数就是不同的那个对象, 针对这个示例, Pie就是饼图对象和Base基类对象. 这点要注意, 要不然得不到你想要的效果.
1 个回复 | 最后更新于 2021-04-12
登录后方可回帖
感谢,测试一下 ChartDirector 的 COM 控件: