没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
原创|使用教程|编辑:龚雪|2014-09-10 09:59:23.000|阅读 1345 次
概述:本文为amCharts使用任意文本替代标签教程。amcharts的ValueAxis中有一个属性叫labelFunction。在展现标签之前如果为该属性设置一些功能,将会呼出该功能、传递值、格式化值以及数值轴参考作为参数,该功能将会返回代替原来默认值的字符串。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
尽管你可以像格式化时长一样格式化值轴标签,在值的左右添加单元。不过,你可能需要更多的功能,比如,用字符串代替值的数值轴,或者为分类轴标签添加文本。
amcharts的ValueAxis中有一个属性叫labelFunction。在展现标签之前如果为该属性设置一些功能,将会呼出该功能、传递值、格式化值以及数值轴参考作为参数,该功能将会返回代替原来默认值的字符串。
<img class="img-thumbnail alt=" amcharts="" 用任意文本替代标签"="" data-cke-saved-src="//image.ke049m.cn/images/article/2014/amcharts_Replacing_axis_labels_with_arbitrary_text_.jpg" src="//image.ke049m.cn/images/article/2014/amcharts_Replacing_axis_labels_with_arbitrary_text_.jpg">
var chart;
var chartData = [
{
"category": "Evaluation",
"excelent": 20,
"good": 20,
"average": 20,
"poor": 20,
"bad": 20,
"limit": 78,
"full": 100,
"bullet": 65
}
];
AmCharts.ready(function () {
// FIRST BULLET CHART
// bullet chart is a simple serial chart
chart = new AmCharts.AmSerialChart();
chart.dataProvider = chartData;
chart.categoryField = "category";
chart.rotate = true; // if you want vertical bullet chart, set rotate to false
chart.columnWidth = 1;
chart.startDuration = 1;
// AXES
// category
var categoryAxis = chart.categoryAxis;
categoryAxis.gridAlpha = 0;
// value
var valueAxis = new AmCharts.ValueAxis();
valueAxis.labelFunction = formatValue;
valueAxis.maximum = 100;
valueAxis.axisAlpha = 1;
valueAxis.gridAlpha = 0;
valueAxis.stackType = "regular"; // we use stacked graphs to make color fills
chart.addValueAxis(valueAxis);
// this graph displays the short dash, which usually indicates maximum value reached.
var graph = new AmCharts.AmGraph();
graph.valueField = "limit";
graph.lineColor = "#000000";
// it's a step line with no risers
graph.type = "step";
graph.noStepRisers = true;
graph.lineAlpha = 1;
graph.lineThickness = 3;
graph.columnWidth = 0.5; // change this if you want wider dash
graph.stackable = false; // this graph shouldn't be stacked
chart.addGraph(graph);
// The following graphs produce color bands
graph = new AmCharts.AmGraph();
graph.valueField = "excelent";
graph.lineColor = "#19d228";
graph.showBalloon = false;
graph.type = "column";
graph.fillAlphas = 0.8;
chart.addGraph(graph);
graph = new AmCharts.AmGraph();
graph.valueField = "good";
graph.lineColor = "#b4dd1e";
graph.showBalloon = false;
graph.type = "column";
graph.fillAlphas = 0.8;
chart.addGraph(graph);
graph = new AmCharts.AmGraph();
graph.valueField = "average";
graph.lineColor = "#f4fb16";
graph.showBalloon = false;
graph.type = "column";
graph.fillAlphas = 0.8;
chart.addGraph(graph);
graph = new AmCharts.AmGraph();
graph.valueField = "poor";
graph.lineColor = "#f6d32b";
graph.showBalloon = false;
graph.type = "column";
graph.fillAlphas = 0.8;
chart.addGraph(graph);
graph = new AmCharts.AmGraph();
graph.valueField = "bad";
graph.lineColor = "#fb7116";
graph.showBalloon = false;
graph.type = "column";
graph.fillAlphas = 0.8;
chart.addGraph(graph);
// this is the "bullet" graph - black bar showing current value
graph = new AmCharts.AmGraph();
graph.valueField = "bullet";
graph.lineColor = "#000000";
graph.type = "column";
graph.lineAlpha = 1;
graph.fillAlphas = 1;
graph.columnWidth = 0.3; // this makes it narrower than color graphs
graph.stackable = false; // bullet graph should not stack
graph.clustered = false; // this makes the trick - one column above another
chart.addGraph(graph);
// WRITE
chart.write("chartdiv");
});
function formatValue(value, formattedValue, valueAxis){
if(value === 0){
return "little";
}
else if(value == 50){
return "so-so";
}
else if (value == 100){
return "a lot!";
}
else{
return "";
}
}
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@ke049m.cn
文章转载自:慧都控件网



注意: Cogent DataHub 软件 v11 包含一些新功能,您的目标操作系统可能不支持这些功能。
本教程主要为大家介绍如何使用DevExpress WinForms数据网格控件进行数据排序的基础知识,欢迎下载最新版组件体验!
在使用Parasoft C/C++test执行BugDetective数据流分析时,可能会遇到用户自定义的资源API,那在这种情况下,若要判断是否存在资源问题,如资源泄露等,则需要手动配置测试配置。
大型SaaS系统的自动化测试常常受制于界面变化快、结构复杂、加载机制多变等因素。从元素识别到脚本管理,SmartBear TestComplete帮助Salesforce建了可靠的自动化测试体系。
相关产品
可将任意给予日期和时间数据可视化的Javascript金融图表工具
JavaScript Charts拥有良好兼容性的JavaScript、HTML5图表开发工具
JavaScript MapsJavaScript Maps是一个稳健的交互式的Javascript/HTML5地图库
最新文章 MORE
半岛外围网上直营相关的文章 MORE
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@ke049m.cn
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
半岛外围网上直营