private void RenderChart(DataTable dt)
        {
            OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();

            ArrayList data1 = new ArrayList();
            IList<string> weekLabels = new List<string>();

            foreach (DataRow row in dt.Rows)
            {
                data1.Add(new LineDotValue(Convert.ToDouble(row["totalAmount"]), string.Format("{0}月供应量{1:F2}", row["month"], row["totalAmount"]), "#fe0"));
                weekLabels.Add(row["month"].ToString());
            }

            OpenFlashChart.LineHollow line1 = new LineHollow();
            line1.Values = data1;
            line1.HaloSize = 0;
            line1.Width = 2;
            line1.DotSize = 5;
            line1.Text = "月供应量";

            line1.Tooltip = "提示:#val#";

            chart.X_Axis.Labels.SetLabels(weekLabels);

            chart.AddElement(line1);

            chart.Title = new Title(string.Format("{0}{1}年月供应量", ddlCompany.SelectedItem.Text, ddlYear.SelectedItem.Text));
            chart.Y_Axis.SetRange(0,300000, 50000);
            chart.Tooltip = new ToolTip("全局提示:#val#");
            chart.Tooltip.Shadow = true;
            chart.Tooltip.Colour = "#e43456";
            chart.Tooltip.MouseStyle = ToolTipStyle.CLOSEST;
            OpenFlashChartControl1.EnableCache = false;
            OpenFlashChartControl1.Chart = chart;
        }
        private void RenderChart()
        {
            OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();

            int productId = 0;
            int.TryParse(Request.QueryString["productId"], out productId);

            if (productId != 0)
            {
                int year = DateTime.Now.Year;
                int.TryParse(ddlYear.SelectedValue, out year);

                DataSet ds = logic.product.productMonthGPMlistByProductAndYear(productId, year);
                string productName = ds.Tables[0].Rows[0]["name"].ToString();
                DataTable dt = ds.Tables[1];

                ArrayList data1 = new ArrayList();
                IList<string> weekLabels = new List<string>();

                foreach (DataRow row in dt.Rows)
                {
                    data1.Add(new LineDotValue(Convert.ToDouble(row["gpmRate"]), string.Format("{0}月毛利率{1:F2}%,当月总毛利{2:F2}元", row["month"], row["gpmRate"], row["gpm"]), "#fe0"));
                    weekLabels.Add(row["month"].ToString());
                }

                OpenFlashChart.LineHollow line1 = new LineHollow();
                line1.Values = data1;
                line1.HaloSize = 0;
                line1.Width = 2;
                line1.DotSize = 5;
                line1.Text = "商品月平均毛利率(百分比)";

                line1.Tooltip = "提示:#val#";

                chart.X_Axis.Labels.SetLabels(weekLabels);

                chart.AddElement(line1);

                chart.Title = new Title(string.Format("{0}{1}年月平均毛利率", productName, year));
                chart.Y_Axis.SetRange(-100, 100, 20);
                chart.Tooltip = new ToolTip("全局提示:#val#");
                chart.Tooltip.Shadow = true;
                chart.Tooltip.Colour = "#e43456";
                chart.Tooltip.MouseStyle = ToolTipStyle.CLOSEST;
                OpenFlashChartControl1.Visible = true;
                OpenFlashChartControl1.EnableCache = false;
                OpenFlashChartControl1.Chart = chart;
            }
            else
            {
                OpenFlashChartControl1.Visible = false;
            }
        }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();
        List <double> data1 = new List <double>();
        Random        rand  = new Random(DateTime.Now.Millisecond);

        for (double i = 0; i < 12; i++)
        {
            data1.Add(rand.Next(30));
        }

        OpenFlashChart.LineHollow line1 = new LineHollow();
        line1.Values           = data1;
        line1.HaloSize         = 0;
        line1.Width            = 2;
        line1.DotSize          = 5;
        line1.DotStyleType.Tip = "#x_label#<br>#val#";
        //line1.DotStyleType.Type = DotType.ANCHOR;
        //line1.DotStyleType.Type = DotType.BOW;
        line1.DotStyleType.Colour = "#467533";
        line1.Tooltip             = "提示:#val#";

        chart.AddElement(line1);
        chart.Y_Legend = new Legend("中文test");
        chart.Title    = new Title("line演示");
        chart.Y_Axis.SetRange(0, 35, 5);
        chart.X_Axis.Labels.Color = "#e43456";
        chart.X_Axis.Steps        = 4;
        chart.Y_Axis.Steps        = 3;
        chart.Tooltip             = new ToolTip("全局提示:#val#");
        chart.Tooltip.Shadow      = true;
        chart.Tooltip.Colour      = "#e43456";
        chart.Tooltip.MouseStyle  = ToolTipStyle.CLOSEST;
        Response.Clear();
        Response.CacheControl = "no-cache";
        Response.Write(chart.ToPrettyString());
        Response.End();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();
        List<double> data1 = new List<double>();
        Random rand = new Random(DateTime.Now.Millisecond);
        for (double i = 0; i < 12; i++)
        {
            data1.Add(rand.Next(30));
        }

        OpenFlashChart.LineHollow line1 = new LineHollow();
        line1.Values = data1;
        line1.HaloSize = 0;
        line1.Width = 2;
        line1.DotSize = 5;
        line1.DotStyleType.Tip = "#x_label#<br>#val#";
        //line1.DotStyleType.Type = DotType.ANCHOR;
        //line1.DotStyleType.Type = DotType.BOW;
        line1.DotStyleType.Colour = "#467533";
        line1.Tooltip = "提示:#val#";

        chart.AddElement(line1);
        chart.Y_Legend = new Legend("中文test");
        chart.Title = new Title("line演示");
        chart.Y_Axis.SetRange(0, 35, 5);
        chart.X_Axis.Labels.Color = "#e43456";
        chart.X_Axis.Steps = 4;
        chart.Y_Axis.Steps = 3;
        chart.Tooltip = new ToolTip("全局提示:#val#");
        chart.Tooltip.Shadow = true;
        chart.Tooltip.Colour = "#e43456";
        chart.Tooltip.MouseStyle = ToolTipStyle.CLOSEST;
        Response.Clear();
        Response.CacheControl = "no-cache";
        Response.Write(chart.ToPrettyString());
        Response.End();
    }
Пример #5
0
        private void getProductGPMByProductId(HttpRequest request, HttpResponse response)
        {
            int productId = 0;
            int.TryParse(request.QueryString["productId"], out productId);

            if (productId != 0)
            {
                int year = DateTime.Now.Year;
                int.TryParse(request.QueryString["year"], out year);

                DataSet ds = logic.product.productMonthGPMlistByProductAndYear(productId, year);
                string productName = ds.Tables[0].Rows[0]["name"].ToString();
                DataTable dt = ds.Tables[1];

                OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();

                ArrayList data1 = new ArrayList();
                IList<string> weekLabels = new List<string>();

                foreach (DataRow row in dt.Rows)
                {
                    data1.Add(new LineDotValue(Convert.ToDouble(row["gpm"]), string.Format("{0}月平均毛利{1}", row["month"], row["gpm"]), "#fe0"));
                    weekLabels.Add(row["month"].ToString());
                }

                OpenFlashChart.LineHollow line1 = new LineHollow();
                line1.Values = data1;
                line1.HaloSize = 0;
                line1.Width = 2;
                line1.DotSize = 5;
                line1.Text = "商品月平均毛利";

                line1.Tooltip = "提示:#val#";

                chart.X_Axis.Labels.SetLabels(weekLabels);

                chart.AddElement(line1);

                chart.Title = new Title(string.Format("{0}{1}年月平均毛利", productName, year));
                chart.Y_Axis.SetRange(0, 1000, 100);
                chart.Tooltip = new ToolTip("全局提示:#val#");
                chart.Tooltip.Shadow = true;
                chart.Tooltip.Colour = "#e43456";
                chart.Tooltip.MouseStyle = ToolTipStyle.CLOSEST;

                response.Clear();
                response.CacheControl = "no-cache";
                response.Write(chart.ToPrettyString());
                response.End();
            }
        }
        private void RenderChart(DataTable dt)
        {
            object maxYValue = dt.Compute("MAX(totalAmount)", "");
            object minYValue = dt.Compute("MIN(totalAmount)", "");

            OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart();

            ArrayList data1 = new ArrayList();
            IList<string> weekLabels = new List<string>();

            foreach (DataRow row in dt.Rows)
            {
                data1.Add(new LineDotValue(Convert.ToDouble(row["totalAmount"]), string.Format("第{0}周订购量{1:F2}", row["weekNum"], row["totalAmount"]), "#fe0"));
                weekLabels.Add(row["weekNum"].ToString());
            }
            //Random rand = new Random(DateTime.Now.Millisecond);
            //for (double i = 0; i < 365; i++)
            //{
            //    data1.Add(rand.Next(30));
            //    weekLabels.Add((i + 1).ToString());
            //}

            OpenFlashChart.LineHollow line1 = new LineHollow();
            line1.Values = data1;
            line1.HaloSize = 0;
            line1.Width = 2;
            line1.DotSize = 5;
            line1.Text = "周订购量";

            line1.Tooltip = "提示:#val#";

            chart.X_Axis.Labels.SetLabels(weekLabels);

            chart.AddElement(line1);

            if (chkEnableCompany.Checked)
            {
                chart.Title = new Title(string.Format("{0}{1}年周订购量", ddlCompany.SelectedItem.Text, ddlYear.SelectedItem.Text));
                chart.Y_Axis.SetRange(0,Convert.ToInt32(maxYValue), 5000);
            }
            else
            {
                chart.Title = new Title(string.Format("{0}年平台周订购量", ddlYear.SelectedItem.Text));
                chart.Y_Axis.SetRange(0,Convert.ToInt32(maxYValue),50000);
            }

            //chart.Y_Axis.SetRange(0,35,5);
            chart.Tooltip = new ToolTip("全局提示:#val#");
            chart.Tooltip.Shadow = true;
            chart.Tooltip.Colour = "#e43456";
            chart.Tooltip.MouseStyle = ToolTipStyle.CLOSEST;
            OpenFlashChartControl1.EnableCache = false;
            OpenFlashChartControl1.Chart = chart;
        }