public void SetGraph(string GraphType, string GraphTheme, short GraphWidth, short GraphHeight, bool ShowValues, bool ShowSeries, bool ShowCat, bool SetScal, bool RotateAxes) { FI.BusinessObjects.OlapReport.GraphTypeEnum graphType = (FI.BusinessObjects.OlapReport.GraphTypeEnum)Enum.Parse(typeof(FI.BusinessObjects.OlapReport.GraphTypeEnum), GraphType, true); _report.GraphType = graphType; _report.GraphTheme = GraphTheme; _report.GraphWidth = GraphWidth; _report.GraphHeight = GraphHeight; FI.BusinessObjects.OlapReport.GraphOptionsEnum graphOptions = FI.BusinessObjects.OlapReport.GraphOptionsEnum.None; if (ShowValues) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowValues); } if (ShowSeries) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowSeries); } if (ShowCat) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowCategories); } if (SetScal) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.SetScaling); } if (RotateAxes) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.RotateAxes); } _report.GraphOptions = graphOptions; _report.SaveHeader(); }
private void LoadGraphOptions() { //chkCat FI.BusinessObjects.OlapReport.GraphOptionsEnum graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowCategories; chkCat.Checked = ((_report.GraphOptions & graphOption) == graphOption); //chkSer graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowSeries; chkSer.Checked = ((_report.GraphOptions & graphOption) == graphOption); //chkVal graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowValues; chkVal.Checked = ((_report.GraphOptions & graphOption) == graphOption); //chkScal graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.SetScaling; chkScal.Checked = ((_report.GraphOptions & graphOption) == graphOption); // selType string[] names = System.Enum.GetNames(_report.GraphType.GetType()); for (int i = 0; i < names.Length; i++) { selType.Items.Add(names[i]); if (_report.GraphType.ToString() == names[i]) { selType.Items[i].Selected = true; } } }
public void SetGraph(string GraphType, bool ShowCat, bool ShowSer, bool ShowVal, bool SetScal) { FI.BusinessObjects.OlapReport.GraphTypeEnum graphType = (FI.BusinessObjects.OlapReport.GraphTypeEnum)Enum.Parse(typeof(FI.BusinessObjects.OlapReport.GraphTypeEnum), GraphType, true); _report.GraphType = graphType; FI.BusinessObjects.OlapReport.GraphOptionsEnum graphOptions = FI.BusinessObjects.OlapReport.GraphOptionsEnum.None; if (ShowCat) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowCategories); } if (ShowSer) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowSeries); } if (ShowVal) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowValues); } if (SetScal) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.SetScaling); } _report.GraphOptions = graphOptions; _report.SaveHeader(); }
private void LoadGraphOptions() { // selType string[] names = System.Enum.GetNames(_report.GraphType.GetType()); Array.Sort(names); for (int i = 0; i < names.Length; i++) { selType.Items.Add(names[i]); if (_report.GraphType.ToString() == names[i]) { selType.Items[i].Selected = true; } } // selColorTheme string theme = (_report.GraphTheme == null || _report.GraphTheme == "" ? _chCtrl.AppearanceName : _report.GraphTheme); string[] themes = _chCtrl.GetAppearanceNames(); for (int i = 0; i < themes.Length; i++) { selColorTheme.Items.Add(themes[i]); if (theme == themes[i]) { selColorTheme.Items[i].Selected = true; } } // hSize and vSize hSize.Text = AdjustGraphSize(_report.GraphWidth).ToString(); vSize.Text = AdjustGraphSize(_report.GraphHeight).ToString(); //chkRotateAxes FI.BusinessObjects.OlapReport.GraphOptionsEnum graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.RotateAxes; chkRotateAxes.Checked = ((_report.GraphOptions & graphOption) == graphOption); //chkScal graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.SetScaling; chkScal.Checked = ((_report.GraphOptions & graphOption) == graphOption); //chkValues graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowValues; chkValues.Checked = ((_report.GraphOptions & graphOption) == graphOption); //chkSeries graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowSeries; chkSeries.Checked = ((_report.GraphOptions & graphOption) == graphOption); //chkCat graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowCategories; chkCat.Checked = ((_report.GraphOptions & graphOption) == graphOption); }
public void SetGraph(string GraphType, string GraphTheme, short GraphWidth, short GraphHeight, byte GraphPieColumns, byte GraphMixedLinePos, bool ShowValues, bool ShowSeries, bool ShowCat, bool SetScal, bool Pivot, bool SetValAsPercent) { FI.BusinessObjects.OlapReport.GraphTypeEnum graphType = (FI.BusinessObjects.OlapReport.GraphTypeEnum)Enum.Parse(typeof(FI.BusinessObjects.OlapReport.GraphTypeEnum), GraphType, true); _report.GraphType = graphType; _report.GraphTheme = GraphTheme; _report.GraphWidth = GraphWidth; _report.GraphHeight = GraphHeight; _report.GraphPieColumns = GraphPieColumns; _report.GraphMixedLinePosition = GraphMixedLinePos; FI.BusinessObjects.OlapReport.GraphOptionsEnum graphOptions = FI.BusinessObjects.OlapReport.GraphOptionsEnum.None; if (ShowValues) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowValues); } if (ShowSeries) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowSeries); } if (ShowCat) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowCategories); } if (SetScal) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.ScalingBySeries); } if (Pivot) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.Pivot); } if (SetValAsPercent) { graphOptions = (graphOptions | FI.BusinessObjects.OlapReport.GraphOptionsEnum.PercentByCategories); } _report.GraphOptions = graphOptions; _report.SaveHeader(); }
public void LoadGraph() { GRAPHCOMLib.GraphClass graph = new GRAPHCOMLib.GraphClass(); //Type switch (_report.GraphType) { case FI.BusinessObjects.OlapReport.GraphTypeEnum.BarVertical: graph.setVertBarType(); break; case FI.BusinessObjects.OlapReport.GraphTypeEnum.BarHorizontal: graph.setHorzBarType(); break; case FI.BusinessObjects.OlapReport.GraphTypeEnum.BarStacked: graph.setStckBarType(); break; case FI.BusinessObjects.OlapReport.GraphTypeEnum.LineHorizontal: graph.setLineType(); break; case FI.BusinessObjects.OlapReport.GraphTypeEnum.Pie: graph.setPieType(); break; default: throw new NotSupportedException(); } //Cat FI.BusinessObjects.OlapReport.GraphOptionsEnum graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowCategories; if ((_report.GraphOptions & graphOption) == graphOption) { graph.setShowCategories(1); } //Ser graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowSeries; if ((_report.GraphOptions & graphOption) == graphOption) { graph.setShowSeries(1); } //Val graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.ShowValues; if ((_report.GraphOptions & graphOption) == graphOption) { graph.setShowValues(1); } //Scal graphOption = FI.BusinessObjects.OlapReport.GraphOptionsEnum.SetScaling; if ((_report.GraphOptions & graphOption) == graphOption) { graph.setScalingBySets(1); } // data if (_report.State == Report.StateEnum.Executed && (_report == null || _report.Cellset.IsValid == false)) { this.cellGraph.CssClass = "tbl1_err"; this.cellGraph.Text = "Report contains no data"; return; } int Ax0MemCount = _report.Cellset.Axis0TupleMemCount; int Ax1MemCount = _report.Cellset.Axis1TupleMemCount; int Ax0PosCount = _report.Cellset.Axis0PosCount; int Ax1PosCount = _report.Cellset.Axis1PosCount; if (Ax0PosCount == 0 || Ax1PosCount == 0) { this.cellGraph.Text = "Report contains no data"; return; } // important!! graph restrictions: if (Ax0PosCount > 32767) { Ax0PosCount = 32767; } if (Ax1PosCount > 127) { Ax1PosCount = 127; } //col captions System.Text.StringBuilder sbCols = new System.Text.StringBuilder(); for (int i = 0; i < Ax0PosCount; i++) { for (int imem = 0; imem < Ax0MemCount; imem++) { sbCols.Append(_report.Cellset.GetCellsetMember(0, imem, i).Name); if (imem < Ax0MemCount - 1) { sbCols.Append(":"); } } sbCols.Append("\t"); } // row captions System.Text.StringBuilder sbRows = new System.Text.StringBuilder(); for (int j = 0; j < Ax1PosCount; j++) { for (int jmem = 0; jmem < Ax1MemCount; jmem++) { sbRows.Append(_report.Cellset.GetCellsetMember(1, jmem, j).Name); if (jmem < Ax1MemCount - 1) { sbRows.Append(":"); } } sbRows.Append("\t"); } // data double[] values = new double[Ax0PosCount * Ax1PosCount]; for (int i = 0; i < Ax0PosCount; i++) { for (int j = 0; j < Ax1PosCount; j++) { string val = _report.Cellset.GetCell(i, j).Value; try { if (val == "") { values[i * Ax1PosCount + j] = 0; } else { values[i * Ax1PosCount + j] = double.Parse(val); } } catch (Exception exc) { values[i * Ax1PosCount + j] = 0; } } } if (sbCols.Length > 0) //remove last tab { sbCols.Remove(sbCols.Length - 1, 1); } if (sbRows.Length > 0) //remove last tab { sbRows.Remove(sbRows.Length - 1, 1); } graph.setValues(Ax1PosCount, Ax0PosCount, ref values[0]); graph.setLegends(sbRows.ToString()); graph.setLabels(sbCols.ToString()); //delete old jpg files if exist string[] filePaths = System.IO.Directory.GetFiles(FI.Common.AppConfig.TempDir, "*.JPG"); if (filePaths != null && filePaths.Length > 0) { for (int i = 0; i < filePaths.Length; i++) { try { DateTime crTime = System.IO.File.GetCreationTime(filePaths[i]); if (crTime.Minute < DateTime.Now.Minute || crTime.DayOfYear < DateTime.Now.DayOfYear) { System.IO.File.Delete(filePaths[i]); } } catch (Exception exc) { //do nothing exc = null; } } } //write to file and display, it will overwite itself if needed string imgName = _report.GetType().Name + _report.ID.ToString() + "." + DateTime.Now.Ticks.ToString() + ".JPG"; string imgVirtPath = Request.ApplicationPath + "/" + FI.Common.AppConfig.TempVirtualDir + "/" + imgName; string imgPhysPath = FI.Common.AppConfig.TempDir + @"\" + imgName; graph.WriteFile(imgPhysPath, 0); System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image(); img.ImageUrl = imgVirtPath; this.cellGraph.Controls.Add(img); }