/// <summary> /// Deserialize a visual returning the appropriate visual object that is derived from /// the base VisualMsx object. /// </summary> /// <param name="data"></param> /// <returns></returns> public static VisualMsx Deserialize( string data, AnalysisApplicationMsx app) { Type visType = null; if (data.IndexOf("<TablePlotMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(TablePlotMsx); } else if (data.IndexOf("<BarChartMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(BarChartMsx); } else if (data.IndexOf("<ScatterPlotMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(ScatterPlotMsx); } else if (data.IndexOf("<TreemapMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(TreemapMsx); } else if (data.IndexOf("<HeatMapMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(HeatMapMsx); } else if (data.IndexOf("<TrellisCardvisualMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(TrellisCardVisualMsx); } else { visType = typeof(VisualMsx); // shouldn't happen } XmlSerializer xmlSer = new XmlSerializer(visType); StringReader reader = new StringReader(data); VisualMsx visMsx = (VisualMsx)(xmlSer.Deserialize(reader)); visMsx.SetApp(app); visMsx.UpdatePostDeserializationSecondaryReferences(); return(visMsx); }
/// <summary> /// Try to get Visual by Guid Id across all pages /// /// </summary> /// <param name="id"></param> /// <param name="visual"></param> /// <returns></returns> public bool TryGetVisual( string id, out VisualMsx visual) { foreach (PageMsx p in Pages.PageList) { if (p.Visuals.TryGetVisual(id, out visual)) { return(true); } } visual = null; return(false); }
//public VisualNavigationMode NavigationMode { get; set; } //public VisualizationAreaSize VisualizationAreaSize { get; } public bool TryGetVisual( string id, out VisualMsx visual) { foreach (VisualMsx vis in VisualList) { if (vis.Id == id) { visual = vis; return(true); } } visual = null; return(false); }
/// <summary> /// Deserialize a visual returning the appropriate visual object that is derived from /// the base VisualMsx object. /// </summary> /// <param name="data"></param> /// <returns></returns> public static VisualMsx DeserializeVisual(string data) { Type visType = null; if (data.IndexOf("<TablePlotMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(TablePlotMsx); } else if (data.IndexOf("<BarChartMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(BarChartMsx); } else if (data.IndexOf("<ScatterPlotMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(ScatterPlotMsx); } else if (data.IndexOf("<TreemapMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(TreemapMsx); } else if (data.IndexOf("<HeatMapMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(HeatMapMsx); } else if (data.IndexOf("<TrellisCardvisualMsx", StringComparison.OrdinalIgnoreCase) == 0) { visType = typeof(TrellisCardVisualMsx); } else { visType = typeof(VisualMsx); // shouldn't happen } XmlSerializer xmlSer = new XmlSerializer(visType); StringReader reader = new StringReader(data); VisualMsx visMsx = (VisualMsx)(xmlSer.Deserialize(reader)); return(visMsx); }