/// <summary> /// Setup /// </summary> /// <param name="view"></param> /// <param name="colorBy"></param> public void Setup( ViewManager view, ColorDimension colorBy) { InSetup = true; View = view; ColorBy = colorBy; FixedColor.Color = colorBy.FixedColor; BorderColor.Color = colorBy.BorderColor; //ColorColumnSelector.Setup(View.BaseQuery, colorBy.QueryColumn); SetupColorSchemeGrid(colorBy.QueryColumn, View); if (colorBy.QueryColumn != null) { ColorByColumn.Checked = true; } else { ColorByFixedColor.Checked = true; } ColumnValueContainsColor.Checked = colorBy.FieldValueContainsColor; InSetup = false; return; }
/// <summary> /// Deserialize /// </summary> /// <param name="vertexName"></param> /// <param name="q"></param> /// <param name="tr"></param> /// <returns></returns> internal static VertexMx Deserialize( string name, Query q, XmlTextReader tr) { Enum iEnum = null; VertexMx v = new VertexMx(); if (XmlUtil.GetEnumAttribute(tr, "ShowLabels", typeof(ShowLabels), ref iEnum)) { v.ShowLabels = (ShowLabels)iEnum; } while (true) // loop through elements of network { tr.Read(); tr.MoveToContent(); if (Lex.Eq(tr.Name, name + "Column")) { v.QueryColumn = ResultsViewProps.DeserializeQueryColumn(q, tr); //tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "Color")) { v.Color = ColorDimension.Deserialize("Color", q, tr); //tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "Size")) { v.Size = SizeDimension.Deserialize("Size", q, tr); //tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "Shape")) { v.Shape = ShapeDimension.Deserialize("Shape", q, tr); //tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "TooltipFields")) { v.TooltipFields = TooltipDimensionDef.Deserialize("TooltipFields", q, tr); //tr.Read(); tr.MoveToContent(); } else if (tr.NodeType == XmlNodeType.EndElement && // end of props Lex.Eq(tr.Name, name)) { break; } else { throw new Exception("Unexpected element: " + tr.Name); } } return(v); }
/// <summary> /// Deserialize /// </summary> /// <param name="name"></param> /// <param name="q"></param> /// <param name="tr"></param> /// <returns></returns> internal static EdgeMx Deserialize( string name, Query q, XmlTextReader tr) { Enum iEnum = null; EdgeMx e = new EdgeMx(); if (XmlUtil.GetEnumAttribute(tr, "ShowLabels", typeof(ShowLabels), ref iEnum)) { e.ShowLabels = (ShowLabels)iEnum; } if (XmlUtil.GetEnumAttribute(tr, "SummarizationType", typeof(SummarizationType), ref iEnum)) { e.SummarizationType = (SummarizationType)iEnum; } XmlUtil.GetBoolAttribute(tr, "IncludeEdgeVertex", ref e.IncludeEdgeVertex); while (true) // loop through elements of network { tr.Read(); tr.MoveToContent(); if (Lex.Eq(tr.Name, name + "Column")) { e.QueryColumn = ResultsViewProps.DeserializeQueryColumn(q, tr); tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "Color")) { e.Color = ColorDimension.Deserialize("Color", q, tr); tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "Width")) { e.Width = SizeDimension.Deserialize("Width", q, tr); tr.Read(); tr.MoveToContent(); } else if (Lex.Eq(tr.Name, "TooltipFields")) { e.TooltipFields = TooltipDimensionDef.Deserialize("TooltipFields", q, tr); //tr.Read(); tr.MoveToContent(); } else if (tr.NodeType == XmlNodeType.EndElement && // end of props Lex.Eq(tr.Name, name)) { break; } else { throw new Exception("Unexpected element: " + tr.Name); } } return(e); }
/// <summary> /// Deserialize Chart Properties /// </summary> /// <param name="q"></param> /// <param name="tr"></param> /// <param name="view"></param> public static bool DeserializeChartProperties( Query q, XmlTextReader tr, ResultsViewProps view) { AxisMx ax; Enum iEnum = null; string txt; if (!Lex.Eq(tr.Name, "ChartProperties")) { return(false); } if (XmlUtil.GetEnumAttribute(tr, "ShapeRenderingMode", typeof(ShapeRenderingMode), ref iEnum)) { view.ShapeRenderingMode = (ShapeRenderingMode)iEnum; } //XmlUtil.GetStringAttribute(tr, "BackgroundImageFile", ref view.BackgroundImageFile); XmlUtil.GetIntAttribute(tr, "Jitter", ref view.JitterX); XmlUtil.GetBoolAttribute(tr, "ChartStretch", ref view.JitterTheSameForXandY); XmlUtil.GetBoolAttribute(tr, "ShowLegend", ref view.ShowLegend); if (tr.GetAttribute("LegendAlignmentHorizontal") != null) { view.LegendAlignmentHorizontal = (LegendAlignmentHorizontal)EnumUtil.Parse(typeof(LegendAlignmentHorizontal), tr.GetAttribute("LegendAlignmentHorizontal")); } if (tr.GetAttribute("LegendAlignmentVertical") != null) { view.LegendAlignmentVertical = (LegendAlignmentVertical)EnumUtil.Parse(typeof(LegendAlignmentVertical), tr.GetAttribute("LegendAlignmentVertical")); } XmlUtil.GetIntAttribute(tr, "LegendMaxHorizontalPercentage", ref view.LegendMaxHorizontalPercentage); XmlUtil.GetIntAttribute(tr, "LegendMaxVerticalPercentage", ref view.LegendMaxVerticalPercentage); if (tr.GetAttribute("LegendItemOrder") != null) { view.LegendItemOrder = (LegendDirection)EnumUtil.Parse(typeof(LegendDirection), tr.GetAttribute("LegendItemOrder")); } XmlUtil.GetBoolAttribute(tr, "MainChartAreaMaximized", ref view.MainViewPanelMaximized); XmlUtil.GetBoolAttribute(tr, "ShowFilters", ref view.ShowFilters); XmlUtil.GetBoolAttribute(tr, "ShowSelectedDataRows", ref view.ShowSelectedDataRows); XmlUtil.GetBoolAttribute(tr, "ShowAxesTitles", ref view.ShowAxesTitles); XmlUtil.GetBoolAttribute(tr, "ShowAxesScaleLabels", ref view.ShowAxesScaleLabels); XmlUtil.GetBoolAttribute(tr, "RotateAxes", ref view.RotateAxes); XmlUtil.GetBoolAttribute(tr, "UseExistingCondFormatting", ref view.UseExistingCondFormatting); XmlUtil.GetBoolAttribute(tr, "PivotedData", ref view.PivotedData); while (true) // loop through elements of chart { tr.Read(); tr.MoveToContent(); if (Lex.Eq(tr.Name, "XAxis")) { view.XAxisMx = AxisMx.DeserializeAxis("XAxis", q, tr); } else if (Lex.Eq(tr.Name, "YAxis")) { view.YAxisMx = AxisMx.DeserializeAxis("YAxis", q, tr); } else if (Lex.Eq(tr.Name, "ZAxis")) { view.ZAxisMx = AxisMx.DeserializeAxis("ZAxis", q, tr); } else if (Lex.Eq(tr.Name, "Axis")) { ax = AxisMx.DeserializeAxis("Axis", q, tr); view.AxesMx.Add(ax); } else if (Lex.Eq(tr.Name, "MarkerColor")) { view.MarkerColor = ColorDimension.Deserialize("MarkerColor", q, tr); } else if (Lex.Eq(tr.Name, "MarkerSize")) { view.MarkerSize = SizeDimension.Deserialize("MarkerSize", q, tr); } else if (Lex.Eq(tr.Name, "MarkerShape")) { view.MarkerShape = ShapeDimension.Deserialize("MarkerShape", q, tr); } else if (Lex.Eq(tr.Name, "MarkerLabel")) { view.MarkerLabel = LabelDimensionDef.Deserialize("MarkerLabel", q, tr); } else if (Lex.Eq(tr.Name, "Labels")) // obsolete label tag { view.MarkerLabel = LabelDimensionDef.Deserialize("Labels", q, tr); } else if (Lex.Eq(tr.Name, "TooltipFields")) { view.MarkerTooltip = TooltipDimensionDef.Deserialize("TooltipFields", q, tr); } else if (Lex.Eq(tr.Name, "Surface")) { txt = tr.GetAttribute("FillMode"); if (txt != null) { view.SurfaceFillMode = (SurfaceFillMode)EnumUtil.Parse(typeof(SurfaceFillMode), txt); } XmlUtil.GetBoolAttribute(tr, "SmoothPalette", ref view.SmoothPalette); XmlUtil.GetBoolAttribute(tr, "SmoothShading", ref view.SmoothShading); XmlUtil.GetBoolAttribute(tr, "SemiTransparent", ref view.SemiTransparent); XmlUtil.GetBoolAttribute(tr, "DrawFlat", ref view.DrawFlat); txt = tr.GetAttribute("FrameMode"); if (txt != null) { view.SurfaceFrameMode = (SurfaceFrameMode)EnumUtil.Parse(typeof(SurfaceFrameMode), txt); } if (tr.IsEmptyElement) { continue; // may be just attributes } tr.Read(); tr.MoveToContent(); if (!Lex.Eq(tr.Name, "Surface")) { throw new Exception("Expected Surface end element"); } } else if (Lex.Eq(tr.Name, "Trellis")) { if (tr.IsEmptyElement) { continue; // may be just attributes } XmlUtil.GetBoolAttribute(tr, "ByRowCol", ref view.TrellisByRowCol); XmlUtil.GetBoolAttribute(tr, "Manual", ref view.TrellisManual); XmlUtil.GetIntAttribute(tr, "MaxRows", ref view.TrellisMaxRows); XmlUtil.GetIntAttribute(tr, "MaxCols", ref view.TrellisMaxCols); while (true) { tr.Read(); tr.MoveToContent(); if (Lex.Eq(tr.Name, "ColumnQc")) { view.TrellisColQc = DeserializeQueryColumnRef(q, tr); } else if (Lex.Eq(tr.Name, "RowQc")) { view.TrellisRowQc = DeserializeQueryColumnRef(q, tr); } else if (Lex.Eq(tr.Name, "PageQc")) { view.TrellisPageQc = DeserializeQueryColumnRef(q, tr); } else if (Lex.Eq(tr.Name, "FlowQc")) { view.TrellisFlowQc = DeserializeQueryColumnRef(q, tr); } else if (tr.NodeType == XmlNodeType.EndElement && // end of trellis definition Lex.Eq(tr.Name, "Trellis")) { break; } else { throw new Exception("Unexpected element: " + tr.Name); } } } else if (tr.NodeType == XmlNodeType.EndElement && // end of chart props Lex.Eq(tr.Name, "ChartProperties")) { break; } else { throw new Exception("Unexpected element: " + tr.Name); } } return(true); }