没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|使用教程|编辑:黄竹雯|2018-12-24 17:21:30.000|阅读 420 次
概述:Web图表控件ChartDirector连载教程分享之条形图描影,内附下载和链接。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
ChartDirector是一个非常理想的图表工具,它拥有广泛的图表类型、分层架构、实时互动的大数据表、普遍适应于各种应用程序以及支持PDF和SVG图标等的优点。此系列连载旨在介绍ChartDirector的实用教程,供大家学习讨论。

此示例演示如何使用条形渐变效果着色水平条形图,以及使用渐变颜色背景、部分圆形框架和绘图区域的大小自动调整来适应图表。
以下代码可在“cppdemo / gradientbar ”中找到。MFC版本的代码可在“mfcdemo”中找到(仅限Windows版本)。QT版本的代码可在“qtdemo”中找到。
#include "chartdir.h"
int main(int argc, char *argv[])
{
// The data for the bar chart
double data[] = {1350, 1600, 1950, 2300, 2700};
// The labels for the bar chart
const char *labels[] = {"2001", "2002", "2003", "2004", "2005"};
// The colors for the bars
int colors[] = {0xcc0000, 0x66aaee, 0xeebb22, 0xcccccc, 0xcc88ff};
// Create a PieChart object of size 600 x 380 pixels.
XYChart *c = new XYChart(600, 380);
// Use the white on black palette, which means the default text and line colors are white
c->setColors(Chart::whiteOnBlackPalette);
// Use a vertical gradient color from blue (0000cc) to deep blue (000044) as background. Use
// rounded corners of 30 pixels radius for the top-left and bottom-right corners.
c->setBackground(c->linearGradientColor(0, 0, 0, c->getHeight(), 0x0000cc, 0x000044));
c->setRoundedFrame(0xffffff, 30, 0, 30, 0);
// Add a title using 18pt Times New Roman Bold Italic font. Add 6 pixels top and bottom margins
// to the title.
TextBox *title = c->addTitle("Annual Revenue for Star Tech", "timesbi.ttf", 18);
title->setMargin(0, 0, 6, 6);
// Add a separator line in white color just under the title
c->addLine(20, title->getHeight(), c->getWidth() - 21, title->getHeight(), 0xffffff);
// Tentatively set the plotarea at (70, 80) and of 480 x 240 pixels in size. Use transparent
// border and white grid lines
c->setPlotArea(70, 80, 480, 240, -1, -1, Chart::Transparent, 0xffffff);
// Swap the axis so that the bars are drawn horizontally
c->swapXY();
// Add a multi-color bar chart layer using the supplied data. Use bar gradient lighting with the
// light intensity from 0.75 to 2.0
c->addBarLayer(DoubleArray(data, (int)(sizeof(data) / sizeof(data[0]))), IntArray(colors, (int)(
sizeof(colors) / sizeof(colors[0]))))->setBorderColor(Chart::Transparent,
Chart::barLighting(0.75, 2.0));
// Set the labels on the x axis.
c->xAxis()->setLabels(StringArray(labels, (int)(sizeof(labels) / sizeof(labels[0]))));
// Show the same scale on the left and right y-axes
c->syncYAxis();
// Set the bottom y-axis title using 10pt Arial Bold font
c->yAxis()->setTitle("USD (millions)", "arialbd.ttf", 10);
// Set y-axes to transparent
c->yAxis()->setColors(Chart::Transparent);
c->yAxis2()->setColors(Chart::Transparent);
// Disable ticks on the x-axis by setting the tick color to transparent
c->xAxis()->setTickColor(Chart::Transparent);
// Set the label styles of all axes to 8pt Arial Bold font
c->xAxis()->setLabelStyle("arialbd.ttf", 8);
c->yAxis()->setLabelStyle("arialbd.ttf", 8);
c->yAxis2()->setLabelStyle("arialbd.ttf", 8);
// Adjust the plot area size, such that the bounding box (inclusive of axes) is 30 pixels from
// the left edge, 25 pixels below the title, 50 pixels from the right edge, and 25 pixels from
// the bottom edge.
c->packPlotArea(30, title->getHeight() + 25, c->getWidth() - 50, c->getHeight() - 25);
// Output the chart
c->makeChart("gradientbar.png");
//free up resources
delete c;
return 0;
}

此示例演示了对条形图使用柱面着色效果。以及展示了绘图区域两侧的拉丝金属背景、圆形框架和轴标签。
以下代码可在“cppdemo / cylinderlightbar ”中找到。MFC版本的代码可在“mfcdemo”中找到(仅限Windows版本)。QT版本的代码可在“qtdemo”中找到。
#include "chartdir.h"
int main(int argc, char *argv[])
{
// The data for the bar chart
double data[] = {450, 560, 630, 800, 1100, 1350, 1600, 1950, 2300, 2700};
// The labels for the bar chart
const char *labels[] = {"1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004",
"2005"};
// Create a XYChart object of size 600 x 380 pixels. Set background color to brushed silver,
// with a 2 pixel 3D border. Use rounded corners of 20 pixels radius.
XYChart *c = new XYChart(600, 380, Chart::brushedSilverColor(), Chart::Transparent, 2);
// Add a title to the chart using 18pt Times Bold Italic font. Set top/bottom margins to 8
// pixels.
c->addTitle("Annual Revenue for Star Tech", "timesbi.ttf", 18)->setMargin(0, 0, 8, 8);
// Set the plotarea at (70, 55) and of size 460 x 280 pixels. Use transparent border and black
// grid lines. Use rounded frame with radius of 20 pixels.
c->setPlotArea(70, 55, 460, 280, -1, -1, Chart::Transparent, 0x000000);
c->setRoundedFrame(0xffffff, 20);
// Add a multi-color bar chart layer using the supplied data. Set cylinder bar shape.
c->addBarLayer(DoubleArray(data, (int)(sizeof(data) / sizeof(data[0]))), IntArray(0, 0)
)->setBarShape(Chart::CircleShape);
// Set the labels on the x axis.
c->xAxis()->setLabels(StringArray(labels, (int)(sizeof(labels) / sizeof(labels[0]))));
// Show the same scale on the left and right y-axes
c->syncYAxis();
// Set the left y-axis and right y-axis title using 10pt Arial Bold font
c->yAxis()->setTitle("USD (millions)", "arialbd.ttf", 10);
c->yAxis2()->setTitle("USD (millions)", "arialbd.ttf", 10);
// Set y-axes to transparent
c->yAxis()->setColors(Chart::Transparent);
c->yAxis2()->setColors(Chart::Transparent);
// Disable ticks on the x-axis by setting the tick color to transparent
c->xAxis()->setTickColor(Chart::Transparent);
// Set the label styles of all axes to 8pt Arial Bold font
c->xAxis()->setLabelStyle("arialbd.ttf", 8);
c->yAxis()->setLabelStyle("arialbd.ttf", 8);
c->yAxis2()->setLabelStyle("arialbd.ttf", 8);
// Output the chart
c->makeChart("cylinderlightbar.jpg");
//free up resources
delete c;
return 0;
}
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@fz165y.cn




大型SaaS系统的自动化测试常常受制于界面变化快、结构复杂、加载机制多变等因素。从元素识别到脚本管理,SmartBear TestComplete帮助Salesforce建了可靠的自动化测试体系。
BarTender 标签管理系统,正是帮助企业轻松实现 GS1 标准化标签设计、编码生成与信息联动的强大工具。
Parasoft C/C++test 是一款功能强大的 C/C++ 软件测试工具,集成了静态代码分析、单元测试、集成测试和覆盖率分析等功能,单元测试作为其关键功能之一,为了适配多样化的目标部署环境,C/C++test 设计了灵活的测试结果收集机制。通过Socket通讯方式来收集单元测试结果,从而扩展其测试覆盖范围与应用场景。
Parasoft C/C++test作为一款功能全面的自动化代码质量保障工具,为C/C++开发者提供了静态分析、单元测试和运行时错误检测等核心功能。通过将其与轻量级且广受欢迎的VScode编辑器集成,开发团队可以在熟悉的编码环境中实时获得代码质量反馈,有效提升开发效率与代码可靠性。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@fz165y.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
星空最火知名网站