OpenFlashChart

这几天琢磨了下OpenFlashChart这个控件。能画出很漂亮的图形报表。

 

有点小心得。

 

1。要先加载dll文件。http://teethgrinder.co.uk/open-flash-chart/.

 

2。在配置文件中要加上一句话,要不是用不了的:

<httpHandlers>

 

<add path="ofc_handler.ofc" verb="*" type="OpenFlashChart.WebHandler.ofcHandler, OpenFlashChart" />

 

</httpHandlers>

 

3。添加引用:

 

using OpenFlashChart;
using ToolTip = OpenFlashChart.ToolTip;
using ToolTipStyle = OpenFlashChart.ToolTipStyle;

 

4。代码:

      private void LineMonth(string Mark, string Year)
     {

       OpenFlashChart.OpenFlashChart chat = new OpenFlashChart.OpenFlashChart();
        List<string> list = new List<string>();
        for (int i = 1; i <= 12; i++)
        {
            list.Add(i + "月");
        }
        
        
        OpenFlashChart.Line line1 = new Line();

 

       //饼图        OpenFlashChart.Pie line1= new Pie();
       //柱图        OpenFlashChart.Bar line1 = new Bar();

       //水晶柱     OpenFlashChart.BarGlass line1 = new BarGlass();


        ArrayList l2 = new ArrayList();

       
        xy_basicinfo xy = new xy_basicinfo();
        int[] count = new int[12];
        count= xy.SelectCountByYear("2009");

        for (int i = 1; i <= 12; i++)
        {
            
            l2.Add(Convert.ToDouble(count[i-1]));
        }

       
        line1.Values = l2; //给线负值

        

        line1.Colour = "#2156B7";
        line1.Tooltip = "报名人数:#val#人";//鼠标点在上面的时候显示的字
        
        chat.AddElement(line1);


        NewMethod(list, chat, Mark, Year);//方法2


        OpenFlashChartControl1.EnableCache = false;
        OpenFlashChartControl1.Chart = chat;

      }

 

    private void NewMethod(List<string> list, OpenFlashChart.OpenFlashChart c, string i, string year)//方法2
    {
        c.Title = new Title(i + year + "年招生信息");
       
        c.Y_Axis.SetRange(0, 6000, 1);//设置 纵坐标的 起始值,最大值,第3个参数我换过 但是没看出什么差别


        c.Y_Axis.Steps = 100;


        c.X_Axis.Offset = true;


        c.X_Axis.SetLabels(list);


        c.Tooltip = new ToolTip("全局提示:#val#");


        c.Tooltip.Shadow = true;


        c.Tooltip.Colour = "#e43456";


        c.Tooltip.MouseStyle = ToolTipStyle.CLOSEST;
    }

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值