protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); List <double> data1 = new List <double>(); for (double i = 0; i < 6.2; i += 0.2) { data1.Add(Math.Sin(i) * 1.9 + 7); } OpenFlashChart.LineHollow line1 = new LineHollow(); line1.Values = data1; line1.HaloSize = 1; line1.Width = 2; line1.DotSize = 5; chart.AddElement(line1); chart.Y_Legend = new Legend("Y轴坐标"); chart.Title = new Title("中文测试"); chart.Y_Axis.SetRange(0, 15, 5); chart.X_Axis.SetLabels(new string[] { "中文测试", "第二" }); chart.X_Axis.Steps = 2; chart.X_Axis.Labels.VisibleSteps = 2; chart.X_Axis.Labels.Vertical = true; Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(chart.ToPrettyString()); Response.End(); }
protected void DataInit(DateTime startTime, DateTime endTime) { //Falsh 初始化 DateTime X_StartDate = new DateTime(); endTime = endTime.AddMonths(1); int monthPoor = endTime.Year * 12 + endTime.Month - startTime.Year * 12 - startTime.Month; //如果间隔时间小于12个月 那么就补成12个月 if (monthPoor <= 12) { MonthCount = 12; X_StartDate = Convert.ToDateTime(endTime.AddMonths(-MonthCount)); //获得开始时间 } else { MonthCount = monthPoor; X_StartDate = startTime; } IList <EyouSoft.Model.TourStructure.TourOrderStatisticsByMonth> dtList = EyouSoft.BLL.TourStructure.TourOrder.CreateInstance().GetTourOrderStatisticsByMonth(X_StartDate, endTime); //生成页面的JS 数组 GetOrderPlotStartEndDate(X_StartDate, out strStartDate, out strEndDate); //为控件绑定数据 OpenFlashChart.OpenFlashChart chart = InitOpenFlashChar(dtList, 5, X_StartDate); OpenFlashChartControl1.Chart = chart; }
/// <summary> /// /// </summary> private void SetYAxis(OpenFlashChart.OpenFlashChart chart, string title) { chart.Y_Legend = new Legend(title); MinMaxFinder finder = new MinMaxFinder(); foreach (ChartBase cb in chart.Elements) { if (cb is LineBase) { finder.Find(cb.Values); } } // TODO: finder has value // double min, max; int step; CalcYAXisInfo(finder.Min, finder.Max, out min, out max, out step); YAxis y = chart.Y_Axis; y.Min = min; y.Max = max; y.Steps = step; }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Bar Chart"); Bar bar = new OpenFlashChart.Bar(); Random random = new Random(); bar.Colour = "#345"; bar.Fillalpha = 0.4; bar.Text = "Test"; bar.Fontsize = 10; List<double> values = new List<double>(); for (int i = 0; i < 12; i++) values.Add(random.Next(i, i * 2)); bar.Values = values; chart.AddElement(bar); //XAxis xaxis = new XAxis(); //// xaxis.Labels = new AxisLabel("text","#ef0",10,"vertical"); //xaxis.Steps = 1; //xaxis.Offset = true; ////xaxis.SetRange(-2, 15); //chart.X_Axis = xaxis; //YAxis yaxis = new YAxis(); //yaxis.Steps = 4; //yaxis.SetRange(0, 20); //chart.Y_Axis = yaxis; string s = chart.ToString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Pie Chart"); OpenFlashChart.Pie pie = new OpenFlashChart.Pie(); Random random = new Random(); List<PieValue> values = new List<PieValue>(); List<string> labels = new List<string>(); for (int i = 0; i < 12; i++) { values.Add(new PieValue(random.NextDouble(),"Pie"+i)); labels.Add(i.ToString()); } values.Add(0.2); pie.Values = values; // pie.Alpha = 50; //pie.Colour = "#fff"; pie.Colours = new string[]{"#04f","#1ff","#6ef","#f30"}; chart.AddElement(pie); string s = chart.ToPrettyString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); List <ScatterValue> data1 = new List <ScatterValue>(); Random rand = new Random(DateTime.Now.Millisecond); for (double i = 0; i < 12; i++) { data1.Add(new ScatterValue(i, rand.Next(30), 5)); } OpenFlashChart.Scatter line1 = new Scatter("#876543", 10); line1.Values = data1; chart.AddElement(line1); chart.Title = new Title("Scatter Demo"); chart.Y_Axis.SetRange(0, 35, 5); chart.X_Axis.SetRange(0, 13); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(chart.ToString()); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Bar Chart"); HBar bar = new OpenFlashChart.HBar(); bar.Colour = "#345"; bar.FillAlpha = 0.4; bar.Text = "Test"; bar.FontSize = 10; bar.Add(new HBarValue(0,5)); bar.Add(new HBarValue(6, 8)); bar.Add(new HBarValue(8, 10)); chart.AddElement(bar); //chart.Y_Axis.SetLabels(new string[] { "hbar1", "hbar2", "hbar3" }); //chart.Y_Axis.Labels.Steps = 3; chart.Tooltip = new ToolTip("提示:#val#"); string s = chart.ToPrettyString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
private void SetXLengend(OpenFlashChart.OpenFlashChart chart, string legend) { Legend xLegend = new Legend(legend); xLegend.Style = "{font-size: 12px; font-family: Times New Roman; font-weight: bold; color: #A2ACBA; text-align: center;}"; chart.X_Legend = xLegend; }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); List <double> data1 = new List <double>(); for (double i = 0; i < 6.2; i += 0.2) { data1.Add(Math.Sin(i) * 1.9 + 7); } OpenFlashChart.LineHollow line1 = new LineHollow(); line1.Values = data1; line1.HaloSize = 0; line1.Width = 2; line1.DotSize = 5; chart.AddElement(line1); chart.Title = new Title("中文测试"); chart.Y_Axis.SetRange(0, 15, 5); chart.X_Axis.Labels.Values = (new string[] { "中文测试", null, "第二" }); //when set to vertical ,the chinese character can not be displayed, //this may due to the flash ActionScript,the flash embeded font do not support chinese well //chart.X_Axis.Labels.Vertical = true; 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.Tooltip = "提示:#val#"; chart.AddElement(line1); line1.SetOnClickFunction("lineclick"); chart.Title = new Title("line演示"); 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; Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(chart.ToString()); Response.End(); }
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; }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); List<double> data3 = new List<double>(); Random random = new Random(DateTime.Now.Millisecond); for (double i = 0; i < 10; i ++) { data3.Add(random.Next(-10,12)); } OpenFlashChart.LineHollow line3 = new LineHollow(); line3.Values = data3; line3.HaloSize = 2; line3.Width = 6; line3.DotSize = 4; line3.FontSize = 12; line3.Text = "line3"; line3.Tooltip = "my tip #val#"; chart.AddElement(line3); chart.Title = new Title("Tooltip Demo"); chart.Y_Axis.SetRange(-10, 15, 5); chart.Tooltip = new ToolTip("my tip #val#"); 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>(); for (double i = 0; i < 6.2; i += 0.2) { data1.Add(Math.Sin(i) * 1.9 + 7); } OpenFlashChart.LineHollow line1 = new LineHollow(); line1.Values = data1; line1.HaloSize = 0; line1.Width = 2; line1.DotSize = 5; chart.AddElement(line1); chart.Title = new Title("中文测试"); chart.Y_Axis.SetRange(0, 15, 5); chart.X_Axis.Labels.Values = (new string[] { "中文测试" ,null,"第二"}); //when set to vertical ,the chinese character can not be displayed, //this may due to the flash ActionScript,the flash embeded font do not support chinese well //chart.X_Axis.Labels.Vertical = true; 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.Tooltip = "提示:#val#"; chart.AddElement(line1); line1.SetOnClickFunction("lineclick"); chart.Title = new Title("line演示"); 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; Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(chart.ToString()); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Pie Chart"); OpenFlashChart.Pie pie = new OpenFlashChart.Pie(); Random random = new Random(); List <PieValue> values = new List <PieValue>(); List <string> labels = new List <string>(); for (int i = 0; i < 12; i++) { values.Add(new PieValue(random.NextDouble(), "Pie" + i)); labels.Add(i.ToString()); } values.Add(0.2); pie.Values = values; // pie.Alpha = 50; //pie.Colour = "#fff"; pie.Colours = new string[] { "#04f", "#1ff", "#6ef", "#f30" }; chart.AddElement(pie); string s = chart.ToPrettyString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Stack Bar"); BarStack bar = new OpenFlashChart.BarStack(); List<BarStackValue> barStackValues = new List<BarStackValue>() ; barStackValues.Add(2); barStackValues.Add( new BarStackValue(3)) ; bar.AddStack(barStackValues); List<BarStackValue> barStackValues1 = new List<BarStackValue>(); barStackValues1.Add(new BarStackValue(5,"#ef4565")); barStackValues1.Add(new BarStackValue(3,"#876567")); bar.AddStack(barStackValues1); chart.AddElement(bar); chart.X_Axis.Steps = 4; chart.X_Axis.Labels.Steps = 4; chart.X_Axis.SetLabels( new string[]{"bar1","bar2"}); chart.X_Axis.Labels.Vertical = true; chart.X_Axis.Set3D(12); chart.Y_Axis.Set3D(3); chart.Y_Axis.Steps = 4; string s = chart.ToString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title=new Title("AreaHollow"); AreaHollow area = new AreaHollow(); Random random=new Random(); area.Colour = "#0fe"; area.DotSize = 2; area.FillAlpha = 0.4; area.Text = "Test"; area.Width = 2; area.FontSize = 10; IList values = new List<double>(); for (int i = 0; i < 12; i++) values.Add(random.Next(i, i*2)); area.Values = values; chart.AddElement(area); XAxis xaxis=new XAxis(); // xaxis.Labels = new AxisLabel("text","#ef0",10,"vertical"); xaxis.Steps = 1; xaxis.SetRange(0,12); chart.X_Axis = xaxis; YAxis yaxis = new YAxis(); yaxis.Steps = 4; yaxis.SetRange(0,20); chart.Y_Axis = yaxis; string s = chart.ToString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); List<double> data1 = new List<double>(); for (double i = 0; i < 6.2; i += 0.2) { data1.Add(Math.Sin(i) * 1.9 + 7); } OpenFlashChart.LineHollow line1 = new LineHollow(); line1.Values = data1; line1.HaloSize = 1; line1.Width = 2; line1.DotSize = 5; chart.AddElement(line1); chart.Y_Legend = new Legend("Y轴坐标"); chart.Title = new Title("中文测试"); chart.Y_Axis.SetRange(0, 15, 5); chart.X_Axis.SetLabels(new string[] { "中文测试" ,"第二"}); chart.X_Axis.Steps = 2; chart.X_Axis.Labels.VisibleSteps = 2; chart.X_Axis.Labels.Vertical = true; 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(); chart.Title = new Title("Bar Chart"); HBar bar = new OpenFlashChart.HBar(); bar.Colour = "#345"; bar.FillAlpha = 0.4; bar.Text = "Test"; bar.FontSize = 10; bar.Add(new HBarValue(0, 5)); bar.Add(new HBarValue(6, 8)); bar.Add(new HBarValue(8, 10)); chart.AddElement(bar); //chart.Y_Axis.SetLabels(new string[] { "hbar1", "hbar2", "hbar3" }); //chart.Y_Axis.Labels.Steps = 3; chart.Tooltip = new ToolTip("提示:#val#"); string s = chart.ToPrettyString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); List <double> data3 = new List <double>(); Random random = new Random(DateTime.Now.Millisecond); for (double i = 0; i < 10; i++) { data3.Add(random.Next(-10, 12)); } OpenFlashChart.LineHollow line3 = new LineHollow(); line3.Values = data3; line3.HaloSize = 2; line3.Width = 6; line3.DotSize = 4; line3.FontSize = 12; line3.Text = "line3"; line3.Tooltip = "my tip #val#"; chart.AddElement(line3); chart.Title = new Title("Tooltip Demo"); chart.Y_Axis.SetRange(-10, 15, 5); chart.Tooltip = new ToolTip("my tip #val#"); 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(); DateTime startOrderDate; DateTime endOrderDate; if (Period == PeriodType.Custom) { startOrderDate = Convert.ToDateTime(StartDate); endOrderDate = Convert.ToDateTime(EndDate); } else { ReportFilterUtilities.GetOrderDateRange(Period, out startOrderDate, out endOrderDate); } SetUpChart(chart, startOrderDate, endOrderDate); double maxRange = 0; DataTable table = CreateDataAndLabel(startOrderDate, endOrderDate); if (table.Rows.Count < 1) { maxRange = InitialMaxYAxisRange; } else { foreach (DataRow row in table.Rows) { double val = ConvertUtilities.ToDouble(row[_value]); if (val > maxRange) { maxRange = val; if (val < InitialMaxYAxisRange) { maxRange = InitialMaxYAxisRange; } } } } chart.AddElement(CreateLine(_data1)); SetChartStyle(chart); SetRangeScale(chart, (int)maxRange); SetYLengend(chart, _yLegend); SetXLengend(chart, _xLegend); SetXAxis(chart, _label1); Response.Clear(); //Response.CacheControl = "no-cache"; Response.Write(chart.ToString()); Response.End(); }
private void SetRangeScale(OpenFlashChart.OpenFlashChart chart, int maxRange) { int step; step = (int)maxRange / InitailYAxisInterval; chart.Y_Axis.SetRange(0, maxRange, step); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); DataTable tbl = DitchDataReal.GetDitchDataRealDataTable(); Line line1 = new Line(); Line line2 = new Line(); //List<AxisLabel> lbls = new List<AxisLabel>(); List <string> lbls = new List <string>(); foreach (DataRow row in tbl.Rows) { // TODO: // int wl1 = Convert.ToInt32(row["wl1"]); int wl2 = Convert.ToInt32(row["wl2"]); string dt = row["dt"].ToString(); string[] temp = dt.Split(' '); dt = temp[0] + "\n" + temp[1]; line1.Values.Add(wl1); line1.Values.Add(wl2); //line1.AppendValue(wl1); //line2.AppendValue(wl2); line1.Colour = "#00ff00"; line1.Set_Key("七亩水位", 2); line2.Set_Key("牛山水位", 4); //AxisLabel label = new AxisLabel(dt); string label = dt.ToString(); //label.Rotate = "270"; lbls.Add(label); } //chart.X_Axis.Labels.AxisLabelValues = lbls; chart.X_Axis.Labels.SetLabels(lbls); //chart.X_Legend.Text = "X"; //chart.X_Legend = new Legend("时间"); //chart.Y_Legend = new Legend("水位"); chart.AddElement(line1); chart.AddElement(line2); chart.Y_Axis.Min = 0d; chart.Y_Axis.Max = 90d; chart.Title.Text = "实时水位"; chart.Tooltip = new ToolTip("#key# : #val# cm"); //chart.X_Axis.Labels.Values. Response.CacheControl = "no-cache"; Response.Write(chart.ToString()); Response.End(); }
private void SetYLengend(OpenFlashChart.OpenFlashChart chart, string legend) { Legend ylegend = new Legend(legend); ylegend.Style = "{font-size: 12px; font-family: Times New Roman; font-weight: bold; color: #A2ACBA; text-align: center;}"; chart.Y_Legend = ylegend; chart.Y_Axis.Colour = "#000000"; chart.Y_Axis.GridColour = "#cccccc"; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); DataTable tbl = DitchDataReal.GetDitchDataRealDataTable(); Line line1 = new Line(); Line line2 = new Line(); //List<AxisLabel> lbls = new List<AxisLabel>(); List<string> lbls = new List<string>(); foreach (DataRow row in tbl.Rows) { // TODO: // int wl1 = Convert.ToInt32(row["wl1"]); int wl2 = Convert.ToInt32(row["wl2"]); string dt = row["dt"].ToString(); string[] temp = dt.Split(' '); dt = temp[0] + "\n"+ temp[1]; line1.Values.Add(wl1); line1.Values.Add(wl2); //line1.AppendValue(wl1); //line2.AppendValue(wl2); line1.Colour = "#00ff00"; line1.Set_Key("七亩水位", 2); line2.Set_Key("牛山水位", 4); //AxisLabel label = new AxisLabel(dt); string label = dt.ToString(); //label.Rotate = "270"; lbls.Add(label); } //chart.X_Axis.Labels.AxisLabelValues = lbls; chart.X_Axis.Labels.SetLabels(lbls); //chart.X_Legend.Text = "X"; //chart.X_Legend = new Legend("时间"); //chart.Y_Legend = new Legend("水位"); chart.AddElement(line1); chart.AddElement(line2); chart.Y_Axis.Min = 0d; chart.Y_Axis.Max = 90d; chart.Title.Text = "实时水位"; chart.Tooltip = new ToolTip("#key# : #val# cm" ); //chart.X_Axis.Labels.Values. Response.CacheControl = "no-cache"; Response.Write(chart.ToString()); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); ArrayList data1 = new ArrayList(); Random rand = new Random(DateTime.Now.Millisecond); for (double i = 0; i < 12; i++) { int temp = rand.Next(30); if (temp > 20) { data1.Add(new LineDotValue(temp, "your tip", "#fe0fe0")); } else { data1.Add(temp); } } LineDotValue dotValue1 = new LineDotValue(rand.Next(30)); dotValue1.Sides = 3; dotValue1.DotType = DotType.HOLLOW_DOT; data1.Add(dotValue1); LineDotValue dotValue2 = new LineDotValue(rand.Next(30)); dotValue2.IsHollow = true; dotValue2.DotType = DotType.STAR; data1.Add(dotValue2); LineDotValue dotValue3 = new LineDotValue(rand.Next(30)); dotValue3.Sides = 4; dotValue3.DotType = DotType.DOT; data1.Add(dotValue3); OpenFlashChart.LineHollow line1 = new LineHollow(); line1.Values = data1; line1.HaloSize = 0; line1.Width = 2; line1.DotSize = 5; line1.Tooltip = "提示:#val#"; chart.AddElement(line1); chart.Title = new Title("line演示"); 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; 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>(); List <double> data2 = new List <double>(); List <double> data3 = new List <double>(); Random random = new Random(DateTime.Now.Millisecond); for (double i = 0; i < 6.2; i += 0.2) { data1.Add(Math.Sin(i) * 1.9 + 7); data2.Add(Math.Sin(i) * 1.9 + 10); data3.Add(random.Next(-10, 12)); } OpenFlashChart.LineHollow line1 = new LineHollow(); line1.Values = data1; line1.HaloSize = 3; line1.Width = 2; line1.DotSize = 5; line1.Fontsize = 12; line1.Colour = "#456f3"; OpenFlashChart.LineHollow line2 = new LineHollow(); line2.Values = data2; line2.HaloSize = 1; line2.Width = 1; line2.DotSize = 4; line2.Fontsize = 12; OpenFlashChart.LineHollow line3 = new LineHollow(); line3.Values = data3; line3.HaloSize = 2; line3.Width = 6; line3.DotSize = 4; line3.Fontsize = 12; line1.Text = "line1"; line2.Text = "line2"; line3.Text = "line3"; chart.AddElement(line1); chart.AddElement(line2); chart.AddElement(line3); chart.Title = new Title("Tooltip Demo"); chart.Y_Axis.SetRange(-10, 15, 5); chart.Tooltip = new ToolTip("my tip #val#"); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(chart.ToPrettyString()); Response.End(); }
/// <summary> /// /// </summary> /// <returns></returns> public string Create() { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); // set title // chart.Title.Text = this.Title; //double min=0; // add element // foreach (ChartDataConfig item in this.ChartDataConfigCollection) { chart.AddElement(item.CreateElement()); chart.X_Axis.SetLabels(item.XAxisLabels); XAxisConfig.Max = item.XAxisLabels.Count; } // x axis // chart.X_Legend = new Legend(XAxisConfig.Title); XAxisConfig.Min = 0; SetAxis(chart.X_Axis, XAxisConfig); // y axis chart.Y_Legend = new Legend(YAxisConfig.Title); AxisCalculator calculator = new AxisCalculator(); calculator.Calc(this.ChartDataConfigCollection.GetMin(), this.ChartDataConfigCollection.GetMax()); YAxisConfig.Min = calculator.Min; YAxisConfig.Max = calculator.Max; YAxisConfig.Step = calculator.Step; SetAxis(chart.Y_Axis, YAxisConfig); // set x axis label // //IList<string> lbls = new List<string>(); //for (int i = 0; i < 30; i++) //{ // if (i % 10 == 0) // { // lbls.Add(DateTime.Now.ToString()); // } // else // { // lbls.Add(""); // } //} //chart.X_Axis.Labels.SetLabels(item); return(chart.ToString()); }
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; } }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); List<double> data1 = new List<double>(); List<double> data2 = new List<double>(); List<double> data3 = new List<double>(); Random random = new Random(DateTime.Now.Millisecond); for (double i = 0; i < 6.2; i += 0.2) { data1.Add(Math.Sin(i) * 1.9 + 7); data2.Add(Math.Sin(i) * 1.9 + 10); data3.Add(random.Next(-10,12)); } OpenFlashChart.LineHollow line1 = new LineHollow(); line1.Values = data1; line1.HaloSize = 3; line1.Width = 2; line1.DotSize = 5; line1.Fontsize = 12; line1.Colour = "#456f3"; OpenFlashChart.LineHollow line2 = new LineHollow(); line2.Values = data2; line2.HaloSize = 1; line2.Width = 1; line2.DotSize = 4; line2.Fontsize = 12; OpenFlashChart.LineHollow line3 = new LineHollow(); line3.Values = data3; line3.HaloSize = 2; line3.Width = 6; line3.DotSize = 4; line3.Fontsize = 12; line1.Text = "line1"; line2.Text = "line2"; line3.Text = "line3"; chart.AddElement(line1); chart.AddElement(line2); chart.AddElement(line3); chart.Title = new Title("Tooltip Demo"); chart.Y_Axis.SetRange(-10, 15, 5); chart.Tooltip = new ToolTip("my tip #val#"); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(chart.ToPrettyString()); Response.End(); }
/// <summary> /// /// </summary> /// <param name="tbl"></param> /// <param name="cfg"></param> /// <returns></returns> public OpenFlashChart.OpenFlashChart Create(DataTable tbl, LineChartConfig cfg) { if (tbl == null || tbl.Rows.Count <= 0) { throw new ArgumentException("tbl is null or tbl.rows == 0"); } if (cfg == null) { throw new ArgumentNullException("cfg"); } OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title(cfg.Title); foreach (LineDataConfig ldcfg in cfg.LineDataConfigCollection) { LineBase linebase = new LineFactory().CreateLine(tbl, ldcfg, cfg.XAxisFieldName); bool isAdd = false; if (IgnoreAllZeroLine) { if (IsAllZeroLine(linebase)) { isAdd = false; } else { isAdd = true; } } else { isAdd = true; } if (isAdd) { chart.Elements.Add(linebase); } } // set yaxis // SetYAxis(chart, cfg.YTitle); // set xaxis // SetXAxis(chart, cfg.XTitle, tbl, cfg.XAxisFieldName); return(chart); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); ArrayList data1 = new ArrayList(); Random rand = new Random(DateTime.Now.Millisecond); for (double i = 0; i < 12; i++) { int temp = rand.Next(30); if (temp > 20) data1.Add(new LineDotValue(temp, "your tip","#fe0fe0")); else { data1.Add(temp); } } LineDotValue dotValue1 = new LineDotValue(rand.Next(30)); dotValue1.Sides = 3; dotValue1.DotType = DotType.HOLLOW_DOT; data1.Add(dotValue1); LineDotValue dotValue2 = new LineDotValue(rand.Next(30)); dotValue2.IsHollow = true; dotValue2.DotType = DotType.STAR; data1.Add(dotValue2); LineDotValue dotValue3 = new LineDotValue(rand.Next(30)); dotValue3.Sides = 4; dotValue3.DotType = DotType.DOT; data1.Add(dotValue3); OpenFlashChart.LineHollow line1 = new LineHollow(); line1.Values = data1; line1.HaloSize = 0; line1.Width = 2; line1.DotSize = 5; line1.Tooltip = "提示:#val#"; chart.AddElement(line1); chart.Title = new Title("line演示"); 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; Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(chart.ToPrettyString()); Response.End(); }
private void showResult() { Cookie cookie = new Cookie(); string taobaoNick = cookie.getCookie("nick"); string session = cookie.getCookie("top_session"); Rijndael_ encode = new Rijndael_("tetesoft"); taobaoNick = encode.Decrypt(taobaoNick); string sql = "SELECT id,name,viewcount,hitcount FROM TopIdea WHERE nick = '" + taobaoNick + "' ORDER BY id DESC"; DataTable dt = utils.ExecuteDataTable(sql); OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("广告浏览次数查看"); OpenFlashChart.Pie pie = new OpenFlashChart.Pie(); Random random = new Random(); List <PieValue> values = new List <PieValue>(); List <string> labels = new List <string>(); for (int i = 0; i < dt.Rows.Count; i++) { values.Add(new PieValue(double.Parse(dt.Rows[i]["viewcount"].ToString()), dt.Rows[i]["name"].ToString())); labels.Add(i.ToString()); } //values.Add(0.2); pie.Values = values; pie.FontSize = 20; pie.Alpha = .5; PieAnimationSeries pieAnimationSeries = new PieAnimationSeries(); pieAnimationSeries.Add(new PieAnimation("bounce", 5)); pie.Animate = pieAnimationSeries; //pie.GradientFillMode = false; //pie.FillAlpha = 10; //pie.Colour = "#ffffff"; pie.Colours = new string[] { "#04f", "#1ff", "#6ef", "#f30" }; pie.Tooltip = "#label#, #percent# of 100%"; chart.AddElement(pie); chart.Bgcolor = "#eeeeee"; string s = chart.ToPrettyString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
private void SetUpChart(OpenFlashChart.OpenFlashChart chart) { if (Period == PeriodType.Custom) { chart.Title = new Title("Shipping Report" + " ( From " + _startOrderDate.ToShortDateString() + " To " + _endOrderDate.ToShortDateString() + ")"); } else { chart.Title = new Title("Shipping Report" + " (" + ReportFilterUtilities.ConvertToPeriodText(Period) + ")"); } chart.Bgcolor = "#ffffff"; chart.Title.Style = "{font-size: 17px; font-family: Times New Roman; font-weight: bold; " + " color: #9bbde0; text-align: center; wmode: transparent; padding-bottom: 30px;}"; }
private void SetUpChart(OpenFlashChart.OpenFlashChart chart, DateTime startOrderDate, DateTime endOrderDate) { if (Period == PeriodType.Custom) { chart.Title = new Title(ReportFilterUtilities.ConvertToCustomerReportText(CustomerReport) + " ( From " + startOrderDate.ToShortDateString() + " To " + endOrderDate.ToShortDateString() + ")"); } else { chart.Title = new Title(ReportFilterUtilities.ConvertToCustomerReportText(CustomerReport) + " (" + ReportFilterUtilities.ConvertToPeriodText(Period) + ")"); } _yLegend = "Register"; _value = "RegisterCustomer"; }
private void SetXAxis(OpenFlashChart.OpenFlashChart chart, List <string> labels) { XAxisLabels xLabels = new XAxisLabels(); xLabels.Values = labels; xLabels.Vertical = true; xLabels.Color = "#000000"; XAxis x = new XAxis(); x.Colour = "#000000"; x.Labels = xLabels; x.GridColour = "#ffffff"; chart.X_Axis = x; }
private void SetUpChart(OpenFlashChart.OpenFlashChart chart, DateTime startOrderDate, DateTime endOrderDate) { if (IsDisplayTitle == "true") { if (Period == PeriodType.Custom) { chart.Title = new Title(ReportFilterUtilities.ConvertToSaleReportText(SaleReport) + " ( From " + startOrderDate.ToShortDateString() + " To " + endOrderDate.ToShortDateString() + ")"); } else { chart.Title = new Title(ReportFilterUtilities.ConvertToSaleReportText(SaleReport) + " (" + ReportFilterUtilities.ConvertToPeriodText(Period) + ")"); } } else { chart.Title = new Title(""); } if (SaleReport == SaleReportType.OrderTotals) { _yLegend = "Amount (" + CurrencyUtilities.BaseCurrencySymbol + ")"; _value = "Total"; } else if (SaleReport == SaleReportType.AverageOrderTotals) { _yLegend = "Amount (" + CurrencyUtilities.BaseCurrencySymbol + ")"; _value = "Average"; } else if (SaleReport == SaleReportType.NumberOfOrder) { _yLegend = "Orders"; _value = "NumberOfOrder"; } else if (SaleReport == SaleReportType.NumberOfItemsSold) { _yLegend = "Items"; _value = "Quantity"; } else if (SaleReport == SaleReportType.AverageItemPerOrder) { _yLegend = "Items"; _value = "AvgQuantity"; } }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Bar Chart"); Bar bar = new OpenFlashChart.Bar(); Random random = new Random(); bar.Colour = "#344565"; bar.Alpha = 0.8; bar.Text = "Test"; bar.FontSize = 10; List <object> values = new List <object>(); for (int i = 0; i < 12; i++) { values.Add(random.Next(i, i * 2)); } BarValue barValue = new BarValue(12); barValue.OnClick = "http://xiao-yifang.blogspot.com"; values.Add(barValue); bar.Values = values; chart.AddElement(bar); XAxis xaxis = new XAxis(); xaxis.Labels.SetLabels(new string[] { "text", "#ef0", "10", "vertical" }); //xaxis.Steps = 1; //xaxis.Offset = true; ////xaxis.SetRange(-2, 15); chart.X_Axis = xaxis; //YAxis yaxis = new YAxis(); //yaxis.Steps = 4; //yaxis.SetRange(0, 20); //chart.Y_Axis = yaxis; chart.Y_Axis.SetRange(0, 24, 3); bar.Tooltip = "提示:label:#x_label#<br>#top#<br>#bottom#<br>#val#"; string s = chart.ToPrettyString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); OpenFlashChart.Pie pie = new OpenFlashChart.Pie(); if (Period == PeriodType.Custom) { _startOrderDate = Convert.ToDateTime(StartDate); _endOrderDate = Convert.ToDateTime(EndDate); } else { ReportFilterUtilities.GetOrderDateRange(Period, out _startOrderDate, out _endOrderDate); } ShippingReportBuilder shippingReportBuilder = new ShippingReportBuilder(); DataTable table = shippingReportBuilder.GetShippingReportData( Period, _startOrderDate, _endOrderDate); for (int i = 0; i < table.Rows.Count; i++) { string shippingMethod; if (String.IsNullOrEmpty(table.Rows[i]["ShippingMethod"].ToString())) { shippingMethod = "Non-shipping Order"; } else { shippingMethod = table.Rows[i]["ShippingMethod"].ToString(); } _values.Add(new PieValue(Convert.ToDouble(table.Rows[i]["SumShippingMethod"]), shippingMethod)); } SetUpChart(chart); SetUpPie(pie); chart.AddElement(pie); Response.Clear(); //Response.CacheControl = "no-cache"; Response.Write(chart.ToString()); 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.Area area = new Area(); area.Values = data1; area.HaloSize = 0; area.Width = 2; area.DotSize = 5; area.DotStyleType.Tip = "#x_label#<br>#val#"; //area.DotStyleType.Type = DotType.ANCHOR; //area.DotStyleType.Type = DotType.BOW; area.DotStyleType.Colour = "#467533"; area.Tooltip = "提示:#val#"; chart.AddElement(area); chart.Y_Legend = new Legend("中文test"); chart.Title = new Title("line演示"); chart.Y_Axis.SetRange(0, 30000, 10000); chart.X_Axis.Labels.Color = "#e43456"; chart.X_Axis.Steps = 4; //num format chart.IsDecimalSeparatorComma = true; chart.NumDecimals = 3; chart.IsFixedNumDecimalsForced = true; 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(); chart.Title = new Title("Pie Chart"); OpenFlashChart.Pie pie = new OpenFlashChart.Pie(); Random random = new Random(); List <PieValue> values = new List <PieValue>(); List <string> labels = new List <string>(); for (int i = 0; i < 12; i++) { values.Add(new PieValue(random.NextDouble(), "Pie" + i)); labels.Add(i.ToString()); } //values.Add(0.2); PieValue pieValue = new PieValue(10); pieValue.Click = "http://xiao-yifang.blogspot.com"; values.Add(pieValue); pie.Values = values; pie.FontSize = 20; pie.Alpha = .5; PieAnimationSeries pieAnimationSeries = new PieAnimationSeries(); pieAnimationSeries.Add(new PieAnimation("bounce", 5)); pie.Animate = pieAnimationSeries; //pie.GradientFillMode = false; //pie.FillAlpha = 10; //pie.Colour = "#fff"; pie.Colours = new string[] { "#04f", "#1ff", "#6ef", "#f30" }; pie.Tooltip = "#label#,#val# of #total##percent# of 100%"; chart.AddElement(pie); chart.Bgcolor = "#202020"; string s = chart.ToPrettyString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); List <double> data1 = new List <double>(); List <double> data2 = new List <double>(); List <double> data3 = new List <double>(); for (double i = 0; i < 6.2; i += 0.2) { data1.Add(Math.Sin(i) * 1.9 + 7); data2.Add(Math.Sin(i) * 1.9 + 10); data3.Add(Math.Sin(i) * 1.9 + 4); } OpenFlashChart.LineHollow line1 = new LineHollow(); line1.Values = data1; line1.HaloSize = 0; line1.Width = 2; line1.DotSize = 5; OpenFlashChart.LineHollow line2 = new LineHollow(); line2.Values = data2; line2.HaloSize = 1; line2.Width = 1; line2.DotSize = 4; OpenFlashChart.LineHollow line3 = new LineHollow(); line3.Values = data3; line3.HaloSize = 1; line3.Width = 6; line3.DotSize = 4; chart.AddElement(line1); chart.AddElement(line2); chart.AddElement(line3); chart.Title = new Title("multi line"); chart.Y_Axis.SetRange(0, 15, 5); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(chart.ToString()); 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.Area area = new Area(); area.Values = data1; area.HaloSize = 0; area.Width = 2; area.DotSize = 5; area.DotStyleType.Tip = "#x_label#<br>#val#"; //area.DotStyleType.Type = DotType.ANCHOR; //area.DotStyleType.Type = DotType.BOW; area.DotStyleType.Colour = "#467533"; area.Tooltip = "提示:#val#"; chart.AddElement(area); chart.Y_Legend = new Legend("中文test"); chart.Title = new Title("line演示"); chart.Y_Axis.SetRange(0, 30000,10000); chart.X_Axis.Labels.Color = "#e43456"; chart.X_Axis.Steps = 4; //num format chart.IsDecimalSeparatorComma = true; chart.NumDecimals = 3; chart.IsFixedNumDecimalsForced = true; 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(); chart.Title = new Title("Bar 3D"); chart.Bgcolor = "99CCFF"; OpenFlashChart.Bar3D bar = new OpenFlashChart.Bar3D(); Random random = new Random(); bar.Colour = "#3f4ff5"; bar.FillAlpha = 0.4; bar.Text = "Test"; bar.FontSize = 10; List <double> values = new List <double>(); List <string> labels = new List <string>(); for (int i = 0; i < 12; i++) { values.Add(random.Next(i, i * 2)); labels.Add(i.ToString()); } bar.Values = values; chart.AddElement(bar); chart.X_Axis.Steps = 4; chart.X_Axis.Labels.Steps = 4; chart.X_Axis.SetLabels(labels); chart.X_Axis.Labels.Vertical = true; chart.X_Axis.Set3D(12); chart.Y_Axis.Set3D(3); chart.Y_Axis.Steps = 4; string s = chart.ToString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Sketch"); BarSketch bar = new OpenFlashChart.BarSketch("#045", "#4f1", 4); Random random = new Random(); bar.Colour = "#345"; bar.Fillalpha = 0.4; bar.Text = "Test"; bar.Fontsize = 10; List <double> values = new List <double>(); List <string> labels = new List <string>(); for (int i = 0; i < 12; i++) { values.Add(random.Next(i, i * 2)); labels.Add(i.ToString()); } bar.Values = values; chart.AddElement(bar); chart.X_Axis.Steps = 4; chart.X_Axis.Labels.Steps = 4; chart.X_Axis.Labels.Values = labels; chart.X_Axis.Labels.Vertical = true; chart.Y_Axis.Steps = 2; Legend x = new Legend("x-axis legend"); chart.X_Legend = x; string s = chart.ToString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); List<double> data1 = new List<double>(); List<double> data2 = new List<double>(); List<double> data3 = new List<double>(); for(double i=0;i<6.2;i+=0.2) { data1.Add(Math.Sin(i)*1.9+7); data2.Add(Math.Sin(i) * 1.9 + 10); data3.Add(Math.Sin(i) * 1.9 + 4); } OpenFlashChart.LineHollow line1 = new LineHollow(); line1.Values = data1; line1.HaloSize = 0; line1.Width = 2; line1.DotSize = 5; OpenFlashChart.LineHollow line2 = new LineHollow(); line2.Values = data2; line2.HaloSize = 1; line2.Width = 1; line2.DotSize = 4; OpenFlashChart.LineHollow line3 = new LineHollow(); line3.Values = data3; line3.HaloSize = 1; line3.Width = 6; line3.DotSize = 4; chart.AddElement(line1); chart.AddElement(line2); chart.AddElement(line3); chart.Title = new Title("multi line"); chart.Y_Axis.SetRange(0,15,5); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(chart.ToString()); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Bar Chart"); Bar bar = new OpenFlashChart.Bar(); Random random = new Random(); bar.Colour = "#344565"; bar.Alpha = 0.8; bar.Text = "Test"; bar.FontSize = 10; List<object> values = new List<object>(); for (int i = 0; i < 12; i++) values.Add(random.Next(i, i * 2)); BarValue barValue = new BarValue(12); barValue.OnClick = "http://xiao-yifang.blogspot.com"; values.Add(barValue); bar.Values = values; chart.AddElement(bar); XAxis xaxis = new XAxis(); xaxis.Labels.SetLabels(new string[] { "text", "#ef0", "10", "vertical" }); //xaxis.Steps = 1; //xaxis.Offset = true; ////xaxis.SetRange(-2, 15); chart.X_Axis = xaxis; //YAxis yaxis = new YAxis(); //yaxis.Steps = 4; //yaxis.SetRange(0, 20); //chart.Y_Axis = yaxis; chart.Y_Axis.SetRange(0,24,3); bar.Tooltip = "提示:label:#x_label#<br>#top#<br>#bottom#<br>#val#"; string s = chart.ToPrettyString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Pie Chart"); OpenFlashChart.Pie pie = new OpenFlashChart.Pie(); Random random = new Random(); List<PieValue> values = new List<PieValue>(); List<string> labels = new List<string>(); for (int i = 0; i < 12; i++) { values.Add(new PieValue(random.NextDouble(),"Pie"+i)); labels.Add(i.ToString()); } //values.Add(0.2); PieValue pieValue = new PieValue(10); pieValue.Click = "http://xiao-yifang.blogspot.com"; values.Add(pieValue); pie.Values = values; pie.FontSize = 20; pie.Alpha = .5; PieAnimationSeries pieAnimationSeries = new PieAnimationSeries(); pieAnimationSeries.Add(new PieAnimation("bounce", 5)); pie.Animate = pieAnimationSeries; //pie.GradientFillMode = false; //pie.FillAlpha = 10; //pie.Colour = "#fff"; pie.Colours = new string[]{"#04f","#1ff","#6ef","#f30"}; pie.Tooltip="#label#,#val# of #total##percent# of 100%"; chart.AddElement(pie); chart.Bgcolor = "#202020"; string s = chart.ToPrettyString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Bar Chart"); Candle candle = new OpenFlashChart.Candle(); Random random = new Random(); candle.Colour = "#345"; candle.FillAlpha = 0.4; candle.Text = "Test"; candle.FontSize = 10; ArrayList values = new ArrayList(); for (int i = 0; i < 12; i++) values.Add(new CandleValue(random.Next(20,30),random.Next(15,20),random.Next(10,15),random.Next(5,10))); candle.Values = values; chart.AddElement(candle); //XAxis xaxis = new XAxis(); //// xaxis.Labels = new AxisLabel("text","#ef0",10,"vertical"); //xaxis.Steps = 1; //xaxis.Offset = true; ////xaxis.SetRange(-2, 15); //chart.X_Axis = xaxis; //YAxis yaxis = new YAxis(); //yaxis.Steps = 4; //yaxis.SetRange(0, 20); //chart.Y_Axis = yaxis; chart.Y_Axis.SetRange(0, 24, 3); candle.Tooltip = "提示:#top#<br>#bottom#<br>#val#"; string s = chart.ToPrettyString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Bar Chart"); BarGlass bar = new OpenFlashChart.BarGlass(); Random random = new Random(); bar.Colour = "#345"; bar.FillAlpha = 0.4; bar.Text = "Test"; bar.FontSize = 10; List<BarGlassValue> values = new List<BarGlassValue>(); for (int i = 0; i < 11; i++) { values.Add(new BarGlassValue(random.Next(i, i * 2))); } BarGlassValue barGlassValue = new BarGlassValue(4); barGlassValue.Tip = "#bottom#:top#top#<br>#val#"; barGlassValue.Color = "#eee"; values.Add(barGlassValue); bar.Values = values; chart.AddElement(bar); YAxis yaxis = new YAxis(); yaxis.Steps = 4; yaxis.SetRange(0, 20); chart.Y_Axis = yaxis; chart.Y_Axis.SetRange(0, 24, 3); chart.Tooltip = new ToolTip("提示:#val#"); string s = chart.ToPrettyString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Sketch"); BarSketch bar = new OpenFlashChart.BarSketch("#045","#4f1",4); Random random = new Random(); bar.Colour = "#345"; bar.FillAlpha = 0.4; bar.Text = "Test"; bar.FontSize = 10; List<double> values = new List<double>(); List<string> labels = new List<string>(); for (int i = 0; i < 12; i++) { values.Add(random.Next(i, i * 2)); labels.Add(i.ToString()); } bar.Values = values; chart.AddElement(bar); chart.X_Axis.Steps = 4; chart.X_Axis.Labels.Steps = 4; chart.X_Axis.SetLabels( labels); chart.X_Axis.Labels.Vertical = true; chart.Y_Axis.Steps = 2; Legend x = new Legend("x-axis legend"); chart.X_Legend = x; string s = chart.ToString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); chart.Title = new Title("Bar 3D"); Bar3D bar = new OpenFlashChart.Bar3D(); Random random = new Random(); bar.Colour = "#345"; bar.Fillalpha = 0.4; bar.Text = "Test"; bar.Fontsize = 10; List<double> values = new List<double>(); List<string> labels = new List<string>(); for (int i = 0; i < 12; i++) {values.Add(random.Next(i, i * 2)); labels.Add(i.ToString()); } bar.Values = values; chart.AddElement(bar); chart.X_Axis.Steps = 4; chart.X_Axis.Labels.Steps = 4; chart.X_Axis.Labels.Values = labels; chart.X_Axis.Labels.Vertical = true; chart.X_Axis.Set3D(12); chart.Y_Axis.Set3D(3); chart.Y_Axis.Steps = 4; string s = chart.ToString(); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(s); 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(); }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); List<ScatterValue> data1 = new List<ScatterValue>(); Random rand = new Random(DateTime.Now.Millisecond); for (double i = 0; i < 12; i++) { data1.Add(new ScatterValue(i, rand.Next(30), 5)); } OpenFlashChart.LineScatter line1 = new LineScatter(); line1.Values = data1; chart.AddElement(line1); line1.Colour = "#823445"; chart.Title = new Title("Scatter Line Demo"); chart.Y_Axis.SetRange(0, 35, 5); chart.X_Axis.SetRange(0, 13); Response.Clear(); Response.CacheControl = "no-cache"; Response.Write(chart.ToString()); 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(15,30)); } OpenFlashChart.AreaLine areaLine = new AreaLine(); areaLine.Values = data1; areaLine.Width = 2; areaLine.DotSize = 5; areaLine.FillColor = "#345"; areaLine.Colour = "#fe0"; areaLine.FillAlpha = 0.5; areaLine.Tooltip = "提示:#val#"; areaLine.Loop = true; chart.AddElement(areaLine); RadarAxis radarAxis = new RadarAxis(12); radarAxis.Steps = 4; //radarAxis.SetLabels(new string[] { "0", "1", "2", "3", "4", "5", "0", "1", "2", "3", "4", "5" ,"23","34"}); chart.Radar_Axis = radarAxis; radarAxis.SetRange(0,30); chart.Title = new Title("Radar Chart"); 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(); }
/// <summary> /// /// </summary> /// <returns></returns> public string Create() { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); // set title // chart.Title.Text = this.Title; //double min=0; // add element // foreach( ChartDataConfig item in this.ChartDataConfigCollection ) { chart.AddElement(item.CreateElement()); chart.X_Axis.SetLabels(item.XAxisLabels); XAxisConfig.Max = item.XAxisLabels.Count; } // x axis // chart.X_Legend = new Legend(XAxisConfig.Title); XAxisConfig.Min = 0; SetAxis(chart.X_Axis, XAxisConfig); // y axis chart.Y_Legend = new Legend(YAxisConfig.Title); AxisCalculator calculator = new AxisCalculator(); calculator.Calc(this.ChartDataConfigCollection.GetMin(), this.ChartDataConfigCollection.GetMax()); YAxisConfig.Min = calculator.Min; YAxisConfig.Max = calculator.Max; YAxisConfig.Step = calculator.Step; SetAxis(chart.Y_Axis, YAxisConfig); // set x axis label // //IList<string> lbls = new List<string>(); //for (int i = 0; i < 30; i++) //{ // if (i % 10 == 0) // { // lbls.Add(DateTime.Now.ToString()); // } // else // { // lbls.Add(""); // } //} //chart.X_Axis.Labels.SetLabels(item); return chart.ToString (); }
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(); } }
protected void Page_Load(object sender, EventArgs e) { OpenFlashChart.OpenFlashChart chart = new OpenFlashChart.OpenFlashChart(); List<double> data1 = new List<double>(); List<double> data2 = new List<double>(); Random rand = new Random(DateTime.Now.Millisecond); for(double i=0;i<12;i++) { data1.Add(rand.Next(30)); data2.Add(rand.Next(50)); } OpenFlashChart.Line line1 = new Line(); 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 = "#x_label#<br>提示:#val#"; OpenFlashChart.Line line2 = new Line(); line2.Values = data2; line2.HaloSize = 1; line2.Width = 3; line2.DotSize = 4; line2.DotStyleType.Tip = "#x_label#<br>#val#"; line1.DotStyleType.Type = DotType.ANCHOR; //line1.DotStyleType.Type = DotType.BOW; line2.DotStyleType.Colour = "#fe4567"; line2.Tooltip = "提示:#val#"; line2.AttachToRightAxis(true); chart.AddElement(line1); chart.AddElement(line2); 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.Labels.VisibleSteps = 3; chart.Y_Axis.Labels.FormatString = "$#val#"; chart.X_Axis.SetLabels(new string[]{"test1","test2"}); //chart.Y_Axis.SetLabels(new string[] { "test1", "test2", "test1", "test2", "test1", "test2" }); chart.X_Axis.Steps = 4; chart.Y_Axis.Steps = 3; chart.Y_Axis.Colour = "#ef6745"; chart.Y_Axis.Labels.Color = "#ef6745"; chart.Y_Axis.Offset = true; chart.Y_RightLegend = new Legend("test y legend right"); chart.Y_Axis_Right = new YAxis(); chart.Y_Axis_Right.Steps = 8; chart.Y_Axis_Right.TickLength = 4; chart.Y_Axis.TickLength = 4; chart.Y_Axis_Right.SetRange(0,60); 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; }