示例#1
0
    protected void btn_Click(object sender, EventArgs e)
    {
        int CurrentYear = DateTime.Now.Year;

        int Count = Convert.ToInt16(txt1.Text) - CurrentYear;

        if (0 <= Count && Count < 5)
        {
            objAccident.intYear = Convert.ToInt16(txt1.Text);
            ArrayList FindAcc = objAccident.FindAccident(objAccident);

            // --- xml Graph---
            StringBuilder xmlDataBirth = new StringBuilder();
            xmlDataBirth.Append("<chart caption='Year-Birth Report' subCaption='By Value' Column3DSliceDepth='10' showBorder='1' formatNumberScale='0' numberSuffix=' '>");


            int Get = FindAcc.Count;
            for (int i = 0; i < Get; i++)
            {
                BL.ArrayAccident obj = (BL.ArrayAccident)(FindAcc[i]);
                int yr  = obj.intYear;
                int val = obj.intNoOfAccidents;

                ListBox1.Items.Add("Year : " + yr + " Val" + val);

                xmlDataBirth.AppendFormat("<set label='{0}' value='{1}' />", yr.ToString(), val.ToString());
            }

            xmlDataBirth.Append("</chart>");
            Literal1.Text = FusionCharts.RenderChart("FusionCharts/Column3D.swf", "", xmlDataBirth.ToString(), "Column3DBirth", "430", "200", false, true);
        }
    }
示例#2
0
    public string CreateCharts()
    {
        //This page demonstrates the ease of generating charts using FusionCharts.
        //For this chart, we've used a string variable to contain our entire XML data.

        //Ideally, you would generate XML data documents at run-time, after interfacing with
        //forms or databases etc.Such examples are also present.
        //Here, we've kept this example very simple.

        //Create an XML data document in a string variable

        string strXML;

        strXML  = "";
        strXML += "<graph caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' decimalPrecision='0' formatNumberScale='0'>";
        strXML += "<set name='Jan' value='462' color='AFD8F8' />";
        strXML += "<set name='Feb' value='857' color='F6BD0F' />";
        strXML += "<set name='Mar' value='671' color='8BBA00' />";
        strXML += "<set name='Apr' value='494' color='FF8E46'/>";
        strXML += "<set name='May' value='761' color='008E8E'/>";
        strXML += "<set name='Jun' value='960' color='D64646'/>";
        strXML += "<set name='Jul' value='629' color='8E468E'/>";
        strXML += "<set name='Aug' value='622' color='588526'/>";
        strXML += "<set name='Sep' value='376' color='B3AA00'/>";
        strXML += "<set name='Oct' value='494' color='008ED6'/>";
        strXML += "<set name='Nov' value='761' color='9D080D'/>";
        strXML += "<set name='Dec' value='960' color='A186BE'/>";
        strXML += "</graph>";

        //Create the chart - Column 3D Chart with data from strXML variable using dataXML method
        return(FusionCharts.RenderChartHTML("../FusionCharts/FCF_Column3D.swf", "", strXML, "myNext", "600", "300", false));
    }
示例#3
0
        public string GetMonthlySalesChartHtml()
        {
            //This page demonstrates the ease of generating charts using FusionCharts.
            //For this chart, we've used a string variable to contain our entire XML data.

            //Ideally, you would generate XML data documents at run-time, after interfacing with
            //forms or databases etc.Such examples are also present.
            //Here, we've kept this example very simple.

            //Create an XML data document in a string variable
            StringBuilder xmlData = new StringBuilder();

            xmlData.Append("<chart caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showValues='0' formatNumberScale='0' showBorder='1'>");
            xmlData.Append("<set label='Jan' value='462' />");
            xmlData.Append("<set label='Feb' value='857' />");
            xmlData.Append("<set label='Mar' value='671' />");
            xmlData.Append("<set label='Apr' value='494' />");
            xmlData.Append("<set label='May' value='761' />");
            xmlData.Append("<set label='Jun' value='960' />");
            xmlData.Append("<set label='Jul' value='629' />");
            xmlData.Append("<set label='Aug' value='622' />");
            xmlData.Append("<set label='Sep' value='376' />");
            xmlData.Append("<set label='Oct' value='494' />");
            xmlData.Append("<set label='Nov' value='761' />");
            xmlData.Append("<set label='Dec' value='960' />");
            xmlData.Append("</chart>");

            //Create the chart - Column 3D Chart with data from xmlData variable using dataXML method
            return(FusionCharts.RenderChart("../../FusionCharts/Column3D.swf", "", xmlData.ToString(), "myNext", "600", "300", false, false));
        }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int[] ab = new int[12];
        order_details.order r = new order_details.order();
        for (int i = 1; i < 13; i++)
        {
            // ab[i-1]  = r.chart_res(i);
        }


        StringBuilder xmlData = new StringBuilder();

        xmlData.Append("<chart bgAlpha='0,0' canvasBgAlpha='0' caption='Monthly Order Sales' xAxisName='Month' yAxisName='Amount'>");
        xmlData.Append("<set label='Jan' value='" + ab[0] + "' />");
        xmlData.Append("<set label='Feb' value='" + ab[1] + "' />");
        xmlData.Append("<set label='Mar' value='" + ab[2] + "' />");
        xmlData.Append("<set label='Apr' value='" + ab[3] + "' />");
        xmlData.Append("<set label='May' value='" + ab[4] + "' />");
        xmlData.Append("<set label='Jun' value='" + ab[5] + "' />");
        xmlData.Append("<set label='Jul' value='" + ab[6] + "' />");
        xmlData.Append("<set label='Aug' value='" + ab[7] + "' />");
        xmlData.Append("<set label='Sep' value='" + ab[8] + "' />");
        xmlData.Append("<set label='Oct' value='" + ab[9] + "' />");
        xmlData.Append("<set label='Nov' value='" + ab[10] + "' />");
        xmlData.Append("<set label='Dec' value='" + ab[11] + "' />");
        xmlData.Append("</chart>");

        Literal1.Text = FusionCharts.RenderChart("js/Column3D.swf", "", xmlData.ToString(), "myNext", "600", "300", false, true);
    }
示例#5
0
        private void Bind()
        {
            try
            {
                string strXml = "";
                FCChart.Text    = "";
                FCChart.Visible = false;
                lblEmtMsg.Text  = "No Data Found";

                List <StatesPopulation> statesPopulation = (new BOStates()).GetStatesGraph();
                if (statesPopulation != null && statesPopulation.Count > 0)
                {
                    strXml          = "<graph caption='' rotateNames='0'  xAxisName='State'   yAxisName='Population' showNames='1' canvasBorderThickness='2' baseFontSize='12'  formatNumberScale='0' decimalPrecision='0' showValue='1'>";
                    FCChart.Visible = true;
                    lblEmtMsg.Text  = "";
                    foreach (StatesPopulation sp in statesPopulation)
                    {
                        strXml = strXml + "<set name='" + sp.StateCode + "' value='" + sp.Population + "' color='" + RandomRGBColor() + "' link='n-../Reports/StatePopulationReport.aspx?state=" + sp.StateID + "'  />";
                    }
                    strXml      += "</graph>";
                    FCChart.Text = FusionCharts.RenderChart("../Charts/" + GraphTypeCheck(), "", strXml, "statesGraph", "800", "400", false, true);

                    dgChart.DataSource = statesPopulation;
                    dgChart.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblErr.Text = ex.Message;
            }
        }
示例#6
0
        private string CreateChart2(string s_titulo)
        {

          

            DataTable dt = new DataTable();
            dt = GetDatosEstadistica("CH2");
            string strXML = "<graph caption='"+s_titulo+"'  showPercentageInLabel='1' pieSliceDepth='10'  decimalPrecision='0' showNames='1'>";

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    strXML += "<set name='" + dt.Rows[i][0].ToString() + "' value='" + dt.Rows[i][1].ToString() + "' />";
                }
            }
            else
                Response.Redirect("SinDatos.aspx?Desde=GeneralFiltro.aspx", false);

            strXML += "</graph>";

            if (Request["tipo"].ToString() != "9")
            return FusionCharts.RenderChart("../FusionCharts/FCF_Pie3D.swf", "", strXML, "Sales1", "600", "250", false, true);
            else
                return FusionCharts.RenderChart("../FusionCharts/FCF_Line.swf", "", strXML, "Sales2", "600", "250", false, true);


        }
示例#7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //This page is invoked from Default.asp. When the user clicks on a pie
        //slice in Default.aspx, the factory Id is passed to this page. We need
        //to get that factory id, get information from database and then show
        //a detailed chart.
        //First, get the factory Id
        // string factoryId ="";
        //Request the factory Id from Querystring
        string factoryId = Request["FactoryId"];

        //xmlData will be used to store the entire XML document generated
        StringBuilder xmlData = new StringBuilder();

        //Generate the chart element string
        xmlData.Append("<chart palette='2' caption='Factory " + factoryId + " Output ' subcaption='(In Units)' xAxisName='Date (dd/MM)' showValues='1' labelStep='2' >");

        //Now, we get the data for that factory
        string query = "select DatePro, Quantity from Factory_Output where FactoryId=" + factoryId;
        DbConn oRs   = new DbConn(query);

        //Iterate through each record
        while (oRs.ReadData.Read())
        {
            //Convert date from database into dd/mm format
            //Generate <set name='..' value='..' />
            xmlData.Append("<set label='" + Convert.ToDateTime(oRs.ReadData["DatePro"]).ToString("dd/MM") + "' value='" + oRs.ReadData["Quantity"].ToString() + "'/>");
        }
        oRs.ReadData.Close();
        //Close <chart> element
        xmlData.Append("</chart>");
        //Create the chart - Column 2D Chart with data from xmlData
        Literal1.Text = FusionCharts.RenderChart("../FusionCharts/Column2D.swf", "", xmlData.ToString(), "FactoryDetailed", "600", "300", false, true);
    }
    /// <summary>
    /// Traffic By Time
    /// </summary>
    public void TrafficByTime()
    {
        // --- xml Graph---
        StringBuilder xmlDataTraffic = new StringBuilder();

        xmlDataTraffic.Append("<chart caption='Split Time-Traffic Status Report' subCaption='' Column3DSliceDepth='10' showBorder='1' formatNumberScale='0' numberSuffix=' '>");
        // ----------------

        objTrafficPredict.strRegion = ddlRegion.SelectedItem.ToString();
        ArrayList DisVehTraffic = objTrafficPredict.DisplyTraffic(objTrafficPredict);

        // Loop only By Traffic
        int Get = DisVehTraffic.Count;

        for (int i = 0; i < Get; i++)
        {
            // --- DisVehPopulation Data To xml ---
            BL.ArrayTraffic objVehicleTraffic = (BL.ArrayTraffic)(DisVehTraffic[i]);
            string          SplitTim          = objVehicleTraffic.strSplitTime;
            double          vehPopValTyp      = objVehicleTraffic.doubleNoOfVehicles;

            xmlDataTraffic.AppendFormat("<set label='{0}' value='{1}' />", SplitTim.ToString(), vehPopValTyp.ToString());
        }

        /// Create The Vehicle Population Chart - Column3D Chart With Data From xmlDataVehPop
        xmlDataTraffic.Append("</chart>");
        LiteralVehicleTrafficByTime.Text = FusionCharts.RenderChart("FusionCharts/Column3D.swf", "", xmlDataTraffic.ToString(), "Column3DTrafficByTime", "810", "300", false, true);
    }
    /// <summary>
    /// Vehicle By Type
    /// </summary>
    public void VehicleByType()
    {
        // --- xml Graph---
        StringBuilder xmlDataVehPopType = new StringBuilder();

        xmlDataVehPopType.Append("<chart caption='Year By VehicleType Report' subCaption='Vehicle Registration' Column3DSliceDepth='10' showBorder='1' formatNumberScale='0' numberSuffix=' '>");
        // ----------------

        objVehiclePopulationPredict.strElementType = ddlVehType.SelectedItem.ToString();
        ArrayList DisVehPopulationType = objVehiclePopulationPredict.VehicleByType(objVehiclePopulationPredict);

        // Loop only By Vehicle Population Type
        int Get = DisVehPopulationType.Count;

        for (int i = 0; i < Get; i++)
        {
            // --- DisVehPopulation Data To xml ---
            BL.ArrayVehiclePopulation objVehiclePop = (BL.ArrayVehiclePopulation)(DisVehPopulationType[i]);
            int    yrPopTyp     = objVehiclePop.intYear;
            double vehPopValTyp = objVehiclePop.doubleNoOfVeh;

            xmlDataVehPopType.AppendFormat("<set label='{0}' value='{1}' />", yrPopTyp.ToString(), vehPopValTyp.ToString());
        }

        /// Create The Vehicle Population Chart - Column3D Chart With Data From xmlDataVehPop
        xmlDataVehPopType.Append("</chart>");
        LiteralVehiclePopulationType.Text = FusionCharts.RenderChart("FusionCharts/Column3D.swf", "", xmlDataVehPopType.ToString(), "Column3DVehiclePopulationType", "400", "350", false, true);
    }
示例#10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int    Id;
        string strQuery2 = "Select FactoryId from Factory_Master";
        DbConn oRs3      = new DbConn(strQuery2);

        StringBuilder strXML = new StringBuilder();

        //Generate the chart element string
        strXML.Append("<chart palette='2' caption='Factory  Output ' subcaption='(In Units)' xAxisName='Date' showValues='1' labelStep='2' >");

        // Connet to the DB
        while (oRs3.ReadData.Read())
        {
            //int Id = Convert.ToInt32(oRs3.ReadData.Read());
            //Now, we get the data for that factory
            Id = Convert.ToInt32(oRs3.ReadData.Read());
            string strQuery = "select Format(DatePro,'dd/MM') as dDate, Quantity from Factory_Output where FactoryId=" + Id.ToString();
            DbConn oRs2     = new DbConn(strQuery);

            //Iterate through each factory
            while (oRs2.ReadData.Read())
            {
                //Here, we convert date into a more readable form for set label.
                strXML.AppendFormat("<set label='{0}' value='{1}' />", oRs2.ReadData["dDate"].ToString(), oRs2.ReadData["Quantity"].ToString());
            }
        }

        //Close <chart> element
        strXML.Append("</chart>");

        //Create the chart - Column 2D Chart with data from strXML
        Literal1.Text = FusionCharts.RenderChart("../FusionCharts/Column2D.swf", "", strXML.ToString(), "FactoryDetailed", "600", "300", false, true, false);
    }
示例#11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //In this example, we show how to connect FusionCharts to a database.
        //For the sake of ease, we've used an MSACCESS databases containing two
        //tables.

        //strXML will be used to store the entire XML document generated
        //Generate the chart element
        StringBuilder xmlData = new StringBuilder();

        xmlData.Append("<chart caption='Factory Output report' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units' >");

        string strQuery = "select a.FactoryId,a.FactoryName,sum(b.Quantity) as TotQ from Factory_Master a,Factory_Output b where a.FactoryId=b.FactoryID group by a.FactoryId,a.FactoryName";

        // Connect to the DB
        DbConn oRs = new DbConn(strQuery);

        //Iterate through each factory
        while (oRs.ReadData.Read())
        {
            //Generate <set label='..' value='..' link='..' />
            //Note that we're setting link as newchart-xmlurl-url
            //This link denotes that linked chart would open
            //The source data for each each is defined in the URL which will get data dynamically from the database as per the fctory id
            xmlData.AppendFormat("<set label='{0}' value='{1}' link='{2}'/>", oRs.ReadData["FactoryName"].ToString(), oRs.ReadData["TotQ"].ToString(), Server.UrlEncode("newchart-xmlurl-FactoryData.aspx?FactoryId=" + oRs.ReadData["FactoryId"].ToString()));
        }

        oRs.ReadData.Close();
        xmlData.Append("</chart>");

        //Create the chart - Pie 3D Chart with data from strXML
        Literal1.Text = FusionCharts.RenderChart("../FusionCharts/Pie3D.swf", "", xmlData.ToString(), "FactorySum", "500", "250", false, true, false);
    }
        void buscar()
        {
            DataTable     dt         = new DataTable();
            StringBuilder xmlGrafico = new StringBuilder();

            dt = dal.getGraficoGestionVentas(txtFechaDesde.Text, txtFechaHasta.Text, ddlVendedorIndicador.SelectedValue, ddlActividadComercial.SelectedValue).Tables[0];

            xmlGrafico.Append("<chart caption='Cantidad'>");
            foreach (DataRow item in dt.Rows)
            {
                xmlGrafico.Append("<set value='" + item["CANT"].ToString() + "' label='" + item["TIPO"].ToString() + "'/>");
            }
            xmlGrafico.Append("</chart>");

            litCantidad.Text = FusionCharts.RenderChart("assets/FusionCharts/Column3D.swf", "", xmlGrafico.ToString(), "Cantidad", "540", "250", false, true);

            StringBuilder xmlGrafico2 = new StringBuilder();

            xmlGrafico2.Append("<chart caption='Pesos'>");
            foreach (DataRow item in dt.Rows)
            {
                string monto = "";
                if (item["MONTO"].ToString() != string.Empty)
                {
                    monto = Convert.ToInt64(Convert.ToDecimal(item["MONTO"].ToString())).ToString();
                }

                string tipo = item["TIPO"].ToString();
                xmlGrafico2.Append("<set value='" + monto + "' label='" + tipo + "'/>");
            }
            xmlGrafico2.Append("</chart>");
            litPesos.Text = FusionCharts.RenderChart("assets/FusionCharts/Column3D.swf", "", xmlGrafico2.ToString(), "Pesos", "540", "250", false, true);
            //litClientesNuevos.Text = FusionCharts.RenderChart("assets/FusionCharts/ScrollColumn2D.swf", "", xmlGrafico.ToString(), "generalGanadasPerdidasPorVendedor", "1000", "400", false, true);
            buscarGrilla();
        }
示例#13
0
    public string CreateChart()
    {
        //We first request the data from the form (Default.asp)
        string intSoups, intSalads, intSandwiches, intBeverages, intDesserts;

        intSoups      = Context.Items["Soups"].ToString();
        intSalads     = Context.Items["Salads"].ToString();
        intSandwiches = Context.Items["Sandwiches"].ToString();
        intBeverages  = Context.Items["Beverages"].ToString();
        intDesserts   = Context.Items["Desserts"].ToString();

        //In this example, we're directly showing this data back on chart.
        //In your apps, you can do the required processing and then show the
        //relevant data only.

        //Now that we've the data in variables, we need to convert this into XML.
        //The simplest method to convert data into XML is using string concatenation.
        string strXML;

        //Initialize <graph> element
        strXML = "<graph caption='Sales by Product Category' subCaption='For this week' showPercentageInLabel='1' pieSliceDepth='25'  decimalPrecision='0' showNames='1'>";
        //Add all data
        strXML += "<set name='Soups' value='" + intSoups + "' />";
        strXML += "<set name='Salads' value='" + intSalads + "' />";
        strXML += "<set name='Sandwiches' value='" + intSandwiches + "' />";
        strXML += "<set name='Beverages' value='" + intBeverages + "' />";
        strXML += "<set name='Desserts' value='" + intDesserts + "' />";
        //Close <graph> element
        strXML += "</graph>";

        //Create the chart - Pie 3D Chart with data from strXML
        return(FusionCharts.RenderChart("../FusionCharts/FCF_Pie3D.swf", "", strXML, "Sales", "600", "350", false, false));
    }
示例#14
0
    /// <summary>
    /// 每天提交量
    /// </summary>
    public string TopEveryday()
    {
        StringBuilder xmlData = new StringBuilder();

        xmlData.Append("<chart caption='每日出单总量' showAboutMenuItem='0' showValues='1' labelDisplay='Stagger' formatNumberScale='0' showBorder='0' outCnvBaseFontSize='12'>");

        DateTime  dtToday   = DateTime.Today;
        string    dateStart = txtDateStart.Text.Trim();
        const int len       = 7;

        if (dateStart != string.Empty)
        {
            dtToday = DateTime.Parse(dateStart);
        }

        for (int i = 0; i < len; i++)
        {
            DateTime dt       = dtToday.AddDays(1 - len + i);
            string   strDate  = dt.ToString("M月d日");
            string   strValue = Case.CountEnableddByInsurer(User.Identity.Name, dt).ToString();

            xmlData.AppendFormat("<set label='{0}' value='{1}' />", strDate, strValue);
        }

        xmlData.Append(@"<styles><definition><style type='font' name='myToolTipFont' size='12' /></definition><application><apply toObject='ToolTip' styles='myToolTipFont' /></application></styles>");
        xmlData.Append("</chart>");

        return(FusionCharts.RenderChart("../images/Column3D.swf", "", xmlData.ToString(), "myNext", "400", "200", false, true));
    }
示例#15
0
        private void ButtonChart_Click(object sender, System.EventArgs e)
        {
            //We first request the data from the form (Default.asp)
            int soups, salads, sandwiches, beverages, desserts;

            soups      = int.Parse(TextBoxSoups.Text);
            salads     = int.Parse(TextboxSalads.Text);
            sandwiches = int.Parse(TextboxSandwiches.Text);
            beverages  = int.Parse(TextboxBeverages.Text);
            desserts   = int.Parse(TextboxDesserts.Text);

            //In this example, we're directly showing this data back on chart.
            //In your apps, you can do the required processing and then show the
            //relevant data only.

            //Now that we've the data in variables, we need to convert this into XML.
            //The simplest method to convert data into XML is using string concatenation.
            string xmlData = String.Empty;

            //Initialize <chart> element
            xmlData = "<chart caption='Sales by Product Category' subCaption='For this week' showPercentValues='1' pieSliceDepth='30' showBorder='1'>";
            //Add all data
            xmlData += "<set label='Soups' value='" + soups + "' />";
            xmlData += "<set label='Salads' value='" + salads + "' />";
            xmlData += "<set label='Sandwiches' value='" + sandwiches + "' />";
            xmlData += "<set label='Beverages' value='" + beverages + "' />";
            xmlData += "<set label='Desserts' value='" + desserts + "' />";
            //Close <chart> element
            xmlData += "</chart>";

            //Create the chart - Pie 3D Chart with data from xmlData
            LiteralChart.Text = FusionCharts.RenderChart("../../FusionCharts/Pie3D.swf", "", xmlData, "Sales", "500", "300", false, false);
        }
示例#16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        StringBuilder xmlData = new StringBuilder();

        xmlData.Append("<chart caption='Factory Output report' subCaption='By Quantity' showBorder='1' formatNumberScale='0' rotatelabels='1' showvalues='0'>");
        xmlData.AppendFormat("<categories>");
        string factoryQuery = "select distinct format(datepro,'dd/mm/yyyy') as dd from factory_output";
        DbConn oRs          = new DbConn(factoryQuery);

        while (oRs.ReadData.Read())
        {
            xmlData.AppendFormat("<category label='{0}'/>", oRs.ReadData["dd"].ToString());
        }
        oRs.ReadData.Close();
        xmlData.AppendFormat("</categories>");
        string factoryquery2 = "select * from factory_master";
        DbConn oRs1          = new DbConn(factoryquery2);

        while (oRs1.ReadData.Read())
        {
            xmlData.AppendFormat("<dataset seriesName='{0}'>", oRs1.ReadData["factoryname"].ToString());
            string factoryquery3 = "select quantity from factory_output where factoryid=" + oRs1.ReadData["factoryid"].ToString();
            DbConn oRs2          = new DbConn(factoryquery3);
            while (oRs2.ReadData.Read())
            {
                xmlData.AppendFormat("<set value='{0}'/>", oRs2.ReadData[0].ToString());
            }
            oRs2.ReadData.Close();
            xmlData.AppendFormat("</dataset>");
        }
        oRs1.ReadData.Close();
        xmlData.AppendFormat("</chart>");
        Literal1.Text = Literal1.Text = FusionCharts.RenderChart("../FusionCharts/MSLine.swf", "", xmlData.ToString(), "myFirst", "600", "300", false, true, false);
    }
    /// <summary>
    /// drillDown to show Column2D chart
    /// </summary>
    /// <param name="FacID">Factory Id</param>
    private void drillDown(string FacID)
    {
        //SQL Query for Factory Details for the factory Id passed as parameter
        string strSQL = "select  a.FactoryId,a.FactoryName,b.DatePro,b.Quantity from Factory_Master a,Factory_Output b where a.FactoryId=b.FactoryID and a.FactoryId=" + FacID + " order by b.DatePro";

        // Create data reader
        DbConn oRs = new DbConn(strSQL);

        //strXML for storing XML
        StringBuilder strXML = new StringBuilder();

        //Add Chart element
        strXML.AppendFormat("<chart caption='Factory wise Production' subcaption='Factory {0} : Daily Production' xAxisName='Day' yAxisName='Units' rotateLabels='1' bgAlpha='100' bgColor='ffffff' showBorder='0' showvalues='0' yAxisMaxValue='200'>", FacID);
        //Iterate through database
        while (oRs.ReadData.Read())
        {
            // add set element
            strXML.AppendFormat("<set label='{0}' value='{1}' />", Convert.ToDateTime(oRs.ReadData["DatePro"]).ToString("d/M"), oRs.ReadData["Quantity"].ToString());
        }
        // close data reader
        oRs.ReadData.Close();

        // close chart element
        strXML.Append("</chart>");

        // create Column2D chart and srore it to output string
        string outPut = FusionCharts.RenderChartHTML("../FusionCharts/Column2D.swf", "", strXML.ToString(), "chart2", "450", "350", false);

        // clear the Panel
        Panel1.Controls.Clear();
        //Add chart to the panel
        Panel1.Controls.Add(new LiteralControl(outPut));
    }
示例#18
0
    public string GetFactorySummaryChartHtml()
    {
        //xmlData will be used to store the entire XML document generated
        StringBuilder xmlData = new StringBuilder();

        //Generate the chart element
        xmlData.Append("<chart caption='Factory Output report' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units' >");

        //Create recordset to get details for the factories
        string factoryQuery = "select a.FactoryId, a.FactoryName, sum(b.Quantity) as TotQ from .Factory_Master a, Factory_Output b where a.FactoryId=b.FactoryID group by a.FactoryId, a.FactoryName ";
        DbConn oRs          = new DbConn(factoryQuery);

        //Iterate through each record
        while (oRs.ReadData.Read())
        {
            //Generate <set name='..' value='..' link='...'/>
            //The link causes drill-down by calling (here) a JavaScript function
            //The function is passed the Factory id
            //The function updates the second chart
            xmlData.AppendFormat("<set label='{0}' value='{1}' link='javaScript:updateChart({2})' />", oRs.ReadData["FactoryName"].ToString(), oRs.ReadData["TotQ"].ToString(), oRs.ReadData["FactoryId"].ToString());
        }
        //Close chart element
        xmlData.Append("</chart>");

        //Create the chart - Pie 3D Chart with data from xmlData
        return(FusionCharts.RenderChart("../FusionCharts/Pie3D.swf", "", xmlData.ToString(), "FactorySum", "500", "250", false, true));
    }
示例#19
0
        private void Bind()
        {
            try
            {
                string strXml = "";
                FCChart.Text    = "";
                FCChart.Visible = false;
                lblEmtMsg.Text  = "No Data Found";

                List <TeamChamp> teamChamps = (new BOTeams()).GetTeamChampions();
                if (teamChamps != null && teamChamps.Count > 0)
                {
                    strXml          = "<graph caption='' rotateNames='0'  xAxisName='Team Name'   yAxisName='Champions Count' showNames='1' canvasBorderThickness='2' baseFontSize='12'  formatNumberScale='0' decimalPrecision='0' showValue='1'>";
                    FCChart.Visible = true;
                    lblEmtMsg.Text  = "";
                    foreach (TeamChamp tc in teamChamps)
                    {
                        strXml = strXml + "<set name='" + tc.TeamName + "' value='" + tc.Champions.ToString() + "' color='" + RandomRGBColor() + "' link='n-../Reports/TeamChampsReport.aspx?team=" + tc.TeamID + "'  />";
                    }
                    strXml      += "</graph>";
                    FCChart.Text = FusionCharts.RenderChart("../Charts/" + GraphTypeCheck(), "", strXml, "teamsGraph", "800", "400", false, true);

                    dgChart.DataSource = teamChamps;
                    dgChart.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblErr.Text = ex.Message;
            }
        }
示例#20
0
    private void CreatePieGraph()
    {
        string strCaption    = "Year wise Sales report";
        string strSubCaption = "2000 - 2008";
        string xAxis         = "No_of_Orders";
        string yAxis         = "Order_Status";

        //strXML will be used to store the entire XML document generated
        string strXML = null;

        //Generate the graph element
        strXML = @"<graph caption='" + strCaption + @"' subCaption='" + strSubCaption + @"' decimalPrecision='0' 
                          pieSliceDepth='30' formatNumberScale='0'
                          xAxisName='" + xAxis + @"' yAxisName='" + yAxis + @"' rotateNames='1'>";

        int i = 0;

        foreach (DataRow DR in dt.Rows)
        {
            strXML += "<set name='" + DR[0].ToString() + "' value='" + DR[1].ToString() + "' color='" + color[i] + @"'  link=&quot;JavaScript:myJS('" + DR["Order_Status"].ToString() + ", " + DR["No_of_Orders"].ToString() + "'); &quot;/>";
            i++;
        }

        //Finally, close <graph> element
        strXML += "</graph>";

        FCLiteral1.Text = FusionCharts.RenderChartHTML(
            "FusionCharts/FCF_Line.swf",       // Path to chart's SWF
            "",                                // Leave blank when using Data String method
            strXML,                            // xmlStr contains the chart data
            "mygraph1",                        // Unique chart ID
            GraphWidth, GraphHeight,           // Width & Height of chart
            false
            );
    }
        private void Bind()
        {
            try
            {
                string strXml = "";
                FCChart.Text    = "";
                FCChart.Visible = false;
                lblEmtMsg.Text  = "No Data Found";

                List <StateUser> userCounts = (new BOUsers()).GetUsersGraph();
                if (userCounts != null && userCounts.Count > 0)
                {
                    strXml          = "<graph caption='' rotateNames='0'  xAxisName='State'   yAxisName='Users Count' showNames='1' canvasBorderThickness='2' baseFontSize='12'  formatNumberScale='0' decimalPrecision='0' showValue='1'>";
                    FCChart.Visible = true;
                    lblEmtMsg.Text  = "";
                    foreach (StateUser su in userCounts)
                    {
                        strXml = strXml + "<set name='" + su.StateName + "' value='" + su.UserCount.ToString() + "' color='" + RandomRGBColor() + "' link='n-../Reports/StateUsersReport.aspx?state=" + su.StateID + "'  />";
                    }
                    strXml      += "</graph>";
                    FCChart.Text = FusionCharts.RenderChart("../Charts/" + GraphTypeCheck(), "", strXml, "userGraph", "800", "400", false, true);

                    dgChart.DataSource = userCounts;
                    dgChart.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblErr.Text = ex.Message;
            }
        }
示例#22
0
    /// <summary>
    /// Population
    /// </summary>
    public void Population()
    {
        objPopulation.strPredictDistrict = "Colombo";
        objPopulation.intPredictYear     = EntrYr;

        objPopulation.FindBirth(objPopulation);
        objPopulation.FindDeath(objPopulation);
        ArrayList CalcPop = objPopulation.FindPopulation(objPopulation);

        // ---Graph---
        /// --- Population ---
        StringBuilder xmlDataPopu = new StringBuilder();

        xmlDataPopu.Append("<chart caption='Year- Human Population Report' subCaption='' Column3DSliceDepth='10' showBorder='1' formatNumberScale='0' numberSuffix=' '>");
        // ----------

        /// --- Population ---
        int j          = CalcPop.Count - 1;
        int GetPopLoop = CalcPop.Count;

        for (int i = 0; i < GetPopLoop; i++)
        {
            BL.ArrayPopulation arrPop = (BL.ArrayPopulation)(CalcPop[j]);
            int    PopYr = arrPop.intPopulationYear;
            double Popu  = arrPop.doublePopulationCount;
            j--;

            xmlDataPopu.AppendFormat("<set label='{0}' value='{1}' />", PopYr.ToString(), Popu.ToString());
        }

        xmlDataPopu.Append("</chart>");
        PopulationGraph.Text = FusionCharts.RenderChart("FusionCharts/Bar2D.swf", "", xmlDataPopu.ToString(), "Bar2DPopulation", "400", "300", false, true);
    }
示例#23
0
        private void Bind(string startDate, string endDate)
        {
            try
            {
                string strXml = "";
                FCChart.Text    = "";
                FCChart.Visible = false;
                lblEmtMsg.Text  = "No Data Found";

                List <TypeMovie> typeMovies = (new BOMovies()).GetMoviesGraph(startDate, endDate);
                if (typeMovies != null && typeMovies.Count > 0)
                {
                    strXml          = "<graph caption='' rotateNames='0'  xAxisName='Type'   yAxisName='Movies Count' showNames='1' canvasBorderThickness='2' baseFontSize='12'  formatNumberScale='0' decimalPrecision='0' showValue='1'>";
                    FCChart.Visible = true;
                    lblEmtMsg.Text  = "";
                    foreach (TypeMovie tm in typeMovies)
                    {
                        strXml = strXml + "<set name='" + tm.TypeName + "' value='" + tm.MoviesCount.ToString() + "' color='" + RandomRGBColor() + "' link='n-../Reports/TypeMoviesReport.aspx?type=" + tm.TypeID + "'  />";
                    }
                    strXml      += "</graph>";
                    FCChart.Text = FusionCharts.RenderChart("../Charts/" + GraphTypeCheck(), "", strXml, "moviesGraph", "800", "400", false, true);

                    dgChart.DataSource = typeMovies;
                    dgChart.DataBind();
                }
            }
            catch (Exception ex)
            {
                lblErr.Text = ex.Message;
            }
        }
示例#24
0
    /// <summary>
    /// Vehicle Accident
    /// </summary>
    public void VehcleAccident()
    {
        objAccident.intYear = Convert.ToInt16(txt1.Text);
        ArrayList FindAcc = objAccident.FindAccident(objAccident);

        // --- xml Graph---
        StringBuilder xmlDataAccident = new StringBuilder();

        xmlDataAccident.Append("<chart caption='Year-NoOf Accident Report' subCaption='' Column3DSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' '>");


        int Get = FindAcc.Count;

        for (int i = 0; i < Get; i++)
        {
            BL.ArrayAccident obj = (BL.ArrayAccident)(FindAcc[i]);
            int yr  = obj.intYear;
            int val = obj.intNoOfAccidents;

            xmlDataAccident.AppendFormat("<set label='{0}' value='{1}' />", yr.ToString(), val.ToString());
        }

        xmlDataAccident.Append("</chart>");
        AccidentGraph.Text = FusionCharts.RenderChart("FusionCharts/Pie3D.swf", "", xmlDataAccident.ToString(), "Column3DAccident", "400", "300", false, true);
    }
示例#25
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //In this example, we show how to connect FusionCharts to a database.
        //For the sake of ease, we've used an Access database which is present in
        //../App_Data/FactoryDB.mdb. It just contains two tables, which are linked to each
        //other. 

        //xmlData will be used to store the entire XML document generated
        StringBuilder xmlData = new StringBuilder();

        //Generate the chart element
        xmlData.Append("<chart caption='Factory Output report' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' Units'>");

        //Create recordset to get details for the factories
        string factoryQuery = "select a.FactoryId,a.FactoryName,sum(b.Quantity) as TotQ from Factory_Master a,Factory_Output b where a.FactoryId=b.FactoryID group by a.FactoryId,a.FactoryName";
        DbConn oRs = new DbConn(factoryQuery);

        //Iterate through each record
        while (oRs.ReadData.Read())
        {
            //Generate <set name='..' value='..' />		
            xmlData.AppendFormat("<set label='{0}' value='{1}' />", oRs.ReadData["FactoryName"].ToString(), oRs.ReadData["TotQ"].ToString());
        }

        oRs.ReadData.Close();
        //Close chart element
        xmlData.Append("</chart>");

        //Create the chart - Pie 3D Chart with data from xmlData
        Literal1.Text = FusionCharts.RenderChart("../FusionCharts/Pie3D.swf", "", xmlData.ToString(), "FactorySum", "600", "300", false, true);
    }
示例#26
0
    /// <summary>
    /// GDP
    /// </summary>
    public void GDP()
    {
        objEconomicPredict.intYear = Convert.ToInt16(txt1.Text);
        ArrayList FindGDP = objEconomicPredict.FindGDP(objEconomicPredict);

        // --- xml Graph---
        StringBuilder xmlDataGDP = new StringBuilder();

        xmlDataGDP.Append("<chart caption='Year-National GDP Report' subCaption='' Column3DSliceDepth='10' showBorder='1' formatNumberScale='0' numberSuffix=' '>");

        int Get = FindGDP.Count;

        for (int i = 0; i < Get; i++)
        {
            BL.ArrayEconomic objEcono  = (BL.ArrayEconomic)(FindGDP[i]);
            string           NationGDP = objEcono.strNationalGDP;
            //string TransGDP = objEcono.strTransportGDP;
            int yr = objEcono.intYear;

            //int Yr = objEcono.intYear;

            xmlDataGDP.AppendFormat("<set label='{0}' value='{1}' />", yr.ToString(), NationGDP.ToString());
        }
        xmlDataGDP.Append("</chart>");
        GDPGraph.Text = FusionCharts.RenderChart("FusionCharts/Column3D.swf", "", xmlDataGDP.ToString(), "Pie3DGDP", "400", "300", false, true);
    }
示例#27
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Dictionary <string, int> dic = VisitSessionManager.GetReferrerByAccountId(oper.Account.AccountId, this.txtBeginDate.Text.Trim(), this.txtEndDate.Text.Trim());

        if (dic != null && dic.Count > 0)
        {
            string strXML;
            strXML = "<graph caption='客服对话分析' xAxisName='' baseFontSize='12'  decimalPrecision='0' showNames='1'  pieSliceDepth='30' formatNumberScale='0'>";
            int sunCount = 0;
            foreach (string keyName in dic.Keys)
            {
                if (dic[keyName] != 0)
                {
                    string name = keyName;
                    if (keyName == "")
                    {
                        name = "直接输入网址";
                    }
                    double value = ((double)dic[keyName] / (double)dic.Count) * 100;
                    strXML += "<set name='" + name + "' value='" + dic[keyName] + "' /> ";
                }
            }
            strXML        += "</graph>";
            FCLiteral.Text = FusionCharts.RenderChart("../JS/FusionCharts/Pie3D.swf", "", strXML, "myNext", "600", "300", false, false);
        }
        else
        {
            FCLiteral.Text = "没有数据";
        }
    }
示例#28
0
    /// <summary>
    /// Traffic
    /// </summary>
    public void Traffic()
    {
        objTrafficPredict.intYear = Convert.ToInt16(txt1.Text);
        ArrayList FindTraffic = objTrafficPredict.FindTraffic(objTrafficPredict);

        // --- xml Graph---
        StringBuilder xmlDataTraffic = new StringBuilder();

        xmlDataTraffic.Append("<chart caption='Year-Traffic Count Report' subCaption='' Column3DSliceDepth='10' showBorder='1' formatNumberScale='0' numberSuffix=' '>");

        int Get = FindTraffic.Count;

        for (int i = 0; i < Get; i++)
        {
            BL.ArrayTraffic obj = (BL.ArrayTraffic)(FindTraffic[i]);
            int             yr  = obj.intYear;
            double          val = Math.Ceiling(obj.doubleNoOfVehicles);

            xmlDataTraffic.AppendFormat("<set label='{0}' value='{1}' />", yr.ToString(), val.ToString());

            //ListBox1.Items.Add("Year --->" + yr + " Value --> " + val);
        }

        xmlDataTraffic.Append("</chart>");
        TrafficGraph.Text = FusionCharts.RenderChart("FusionCharts/Line.swf", "", xmlDataTraffic.ToString(), "Column3DTraffic", "825", "350", false, true);
    }
        protected void BindAssetsPiaChart(DataTable dtAssetsPiaChart)
        {
            int count = 0;

            StringBuilder strXML3 = new StringBuilder();

            strXML3.Append(@"<chart caption='Assets Allocation' chartTopMargin='0' bgcolor='FFFFFF' showvalues='1' showpercentvalues='1'  showLegend='1' showHoverEffect='1' captionPadding='0' chartLeftMargin='0'
                        chartRightMargin='0' chartBottomMargin='0' showborder='0' use3dlighting='0' showshadow='0' showLabels='1' legendborder='0' legendposition='bottom' enablesmartlabels='1' legendbgcolor='#CCCCCC' legendbgalpha='20' legendborderalpha='0' legendshadow='0' legendnumcolumns='3'> ");
            if (dtAssetsPiaChart.Rows.Count > 0)
            {
                foreach (DataRow dr in dtAssetsPiaChart.Rows)
                {
                    strXML3.AppendFormat(@"<set label='{0}' value='{1}' />", dr["WAC_AssetClassification"].ToString(), dr["AllocationPercentage"]);
                    count++;
                    if (count > 5)
                    {
                        break;
                    }
                }
                strXML3.Append(@"</chart>");
                ltrAssets.Text = FusionCharts.RenderChartHTML("../Content/Pie2D.swf", "", strXML3.ToString(), "asst", "100%", "350", false, true, true);
            }
            else
            {
                ltrAssets.Text = "No record found";
            }
        }
示例#30
0
    //Graph-2 (All Regions-No Of Vehicles)
    public void RegVSNoOfVehicle()
    {
        //---Region-NO OF Vehicles-----
        StringBuilder xmlData = new StringBuilder();

        xmlData.Append("<chart caption='Region-Vehicle Output Report' subCaption='By Count' pieSliceDepth='30' showBorder='1' formatNumberScale='0' numberSuffix=' '>");

        string        conn     = ConfigurationManager.ConnectionStrings["ERMSdbConnectionString"].ConnectionString;
        SqlConnection constrin = new SqlConnection(conn);

        constrin.Open();

        SqlCommand    sqlcom = new System.Data.SqlClient.SqlCommand("SELECT Region,SUM(NoOfVehicles) as Veh FROM tblTraffic Group By Region", constrin);
        SqlDataReader sqlred = sqlcom.ExecuteReader();

        sqlred.Read();

        while (sqlred.Read())
        {
            //Generate <set name='..' value='..' />
            xmlData.AppendFormat("<set label='{0}' value='{1}' />", sqlred["Region"].ToString(), sqlred["Veh"].ToString());
        }
        sqlred.Close();
        //Close chart element
        xmlData.Append("</chart>");
        ////Create the chart - Pie 3D Chart with data from xmlData
        Graph2.Text = FusionCharts.RenderChart("FusionCharts/Pie3D.swf", "", xmlData.ToString(), "PieRegVehRte", "700", "300", false, true);
        //-------------------------
    }