amcharts报表制作
fusioncharts官网:http://www.fusioncharts.com/demos/gallery/#column-and-bar
最近使用amcharts fb4,flashBuilder4.7制作报表水印不管怎么试验都去不掉,网友提供的重写ChartsLicenseHandler实现其方法,设置属性,修改配置文件等等,没有一个可以去除水印,
最后在绝望中寻找希望,终于去除水印:
如下:方法,重新fb4中的类:
1.重写AmPieChart;
package con.comflex.chart
{
import com.amcharts.AmPieChart;
public class AmChartsPie extends AmPieChart
{
public function AmChartsPie()
{
super();
}
override protected function createChildren():void{
super.createChildren();
this._amchartsLink.visible = false;
return;
}
}
}
2.重写AmRadarChart;
package con.comflex.chart
{
import com.amcharts.AmRadarChart;
public class AmChartsRadar extends AmRadarChart
{
public function AmChartsRadar()
{
super();
}
override protected function createChildren():void{
super.createChildren();
this._amchartsLink.visible = false;
return;
}
}
}
3.重写AmchartsSerial
package con.comflex.chart
{
import com.amcharts.AmSerialChart;
import com.amcharts.chartClasses.AmChart;
public class AmchartsSerial extends AmSerialChart
{
public function AmchartsSerial()
{
super();
}
override protected function createChildren():void{
super.createChildren();
_amchartsLink.visible = false;
return;
}
public function onClickTest():void{
this;
}
}
}
4.重写AmChartsXY;
package con.comflex.chart
package chart
{
import com.amcharts.AmXYChart;
public class AmChartsXY extends AmXYChart
{
public function AmChartsXY()
{
super();
}
override protected function createChildren():void{
super.createChildren();
this._amchartsLink.visible = false;
return;
}
}
}
以上类重新完引入到mxml文件中即可,如下char.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:chart="com.comflex.chart.*"
xmlns:amcharts="http://www.amcharts.com/com_internal">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var chartDataPieAndSerial:ArrayCollection=new ArrayCollection([
{ label:'通畅', value:'50',color:0x078750},
{ label:'拥堵', value:'49',color:0xFF0000},
{ label:'缓慢', value:'40',color:0xFFFF00},
]);
[Bindable]private var chartDataXY:ArrayCollection = new ArrayCollection([
{x:6, y:5, value:15,color:0x078750},
{x:10, y:2.9, value:19,color:0xFF0000},
{x:5, y:8.0, value:5,color:0xFFFF00},
{x:9, y:1.6, value:13,color:0x078750},
{x:2, y:6.2, value:22,color:0xFFFF00},
{x:5, y:9.4, value:15,color:0xFF0000},
{x:11, y:2.2, value:8,color:0x078750}
]);
[Bindable]
private var chartDataRadar:ArrayCollection = new ArrayCollection([
{direction:"N", value:8},
{direction:"NE", value:9},
{direction:"E", value:4.5},
{direction:"SE", value:3.5},
{direction:"S", value:9.2},
{direction:"SW", value:8.4},
{direction:"W", value:11.1},
{direction:"NW", value:10}]);
]]>
</fx:Script>
<s:VGroup width="100%" height="100%" horizontalAlign="center" horizontalCenter="0">
<s:HGroup width="100%" height="45%">
<s:BorderContainer width="33%" height="100%">
<!--在此处添加数据-->
<amcharts:AmLegend dataProvider="{chartSerial}" fontWeight="bold"
width="100%" height="100%" valueWidth="40"
textAlign="left" marginLeft="20" marginRight="10"
rollOverGraphAlpha="0.2"
markerType="square"/>
<chart:AmchartsSerial id="chartSerial" top="25"
width="100%" height="100%" angle="30"
depth3D="20"
dataProvider="{chartDataPieAndSerial}"
categoryField="label" rotate="false">
<chart:graphs>
<amcharts:AmGraph title="Value" valueField="value" colorField="color" lineAlpha="0" type="column" fillAlphas="[1]"/>
<amcharts:AmGraph title="Value" valueField="value" colorField="color" lineAlpha="0" type="column" fillAlphas="[1]"/>
</chart:graphs>
</chart:AmchartsSerial>
</s:BorderContainer>
<s:BorderContainer width="33%" height="100%">
<!--在此处添加数据-->
<amcharts:AmLegend dataProvider="{chartPie}" fontWeight="bold"
width="100%" height="100%" valueWidth="40"
marginLeft="20" marginRight="10" labelText="[[label]]"
markerType="square" valueText="" transformY="20"/>
<chart:AmChartsPie id="chartPie" top="30" dataProvider="{chartDataPieAndSerial}" width="100%" height="100%"
titleField="label" valueField="value" colorField="color" clipLabels="false" clipContent="false" />
</s:BorderContainer>
</s:HGroup>
<s:HGroup width="100%" height="45%">
<s:BorderContainer width="33%" height="100%">
<!--在此处添加数据-->
<chart:AmChartsXY
width="100%"
height="100%"
id="chart"
marginTop="20"
marginRight="20"
marginLeft="60"
dataProvider="{chartDataXY}"
startDuration="1">
<chart:graphs>
<amcharts:AmGraph
id="g0"
xField="x"
yField="y"
valueField="value"
lineAlpha="0"
bullet="bubble"
colorField="color"
/>
</chart:graphs>
<chart:chartCursor>
<amcharts:ChartCursor>
</amcharts:ChartCursor>
</chart:chartCursor>
<chart:chartScrollbar>
<amcharts:ChartScrollbar height="20">
</amcharts:ChartScrollbar>
</chart:chartScrollbar>
</chart:AmChartsXY>
</s:BorderContainer>
<s:BorderContainer width="33%" height="100%">
<!--在此处添加数据-->
<chart:AmChartsRadar id="chartRadar" dataProvider="{chartDataRadar}" categoryField="direction" width="100%" height="100%" startDuration="1">
<chart:valueAxes>
<amcharts:ValueAxis
gridType="circles"
fillAlpha="0.05"
fillColor="0x000000"
axisAlpha="0.2"
gridAlpha="0"
fontWeight="bold"
min="0">
<amcharts:guides>
<amcharts:Guide angle="225" tickLength="0" toAngle="315" value="0" toValue="14" fillColor="0x0066CC" fillAlpha="0.6"/>
<amcharts:Guide angle="45" tickLength="0" toAngle="135" value="0" toValue="14" fillColor="0xCC3333" fillAlpha="0.6"/>
</amcharts:guides>
</amcharts:ValueAxis>
</chart:valueAxes>
<chart:graphs>
<amcharts:AmGraph
lineColor="0xFFCC00"
fillAlphas="[0.4]"
bullet="round"
valueField="value"
balloonText="[[direction]]: [[value]] m/s"/>
</chart:graphs>
</chart:AmChartsRadar>
</s:BorderContainer>
</s:HGroup>
</s:VGroup>
</s:Application>
注意: 以上饼图如果需要3d效果,直接设置属性<amcharts:Guide depth3D="10">即可。
以上完成去除水印功能。