${IS6_ThemeGraph_Title}
${IS6_ThemeGraph_Description}
${IS6_ThemeGraph_Description_1}
//制作统计专题图 private void commit_Click(object sender, RoutedEventArgs e) { List<ServerStyle> themeStyles = new List<ServerStyle>(); themeStyles.Add(new ServerStyle() { BrushColor = new ServerColor(125, 0, 0) }); themeStyles.Add(new ServerStyle() { BrushColor = new ServerColor(220, 50, 127) }); ThemeGraph graph = new ThemeGraph() { Caption = "统计专题图", Expressions = new List<string>() { "SmArea", "Pop_1994" }, GraduatedMode = (GraduatedMode)setGradutedMode.SelectedIndex, GraphStyles = themeStyles, GraphType = (GraphType)setGraphType.SelectedItem, OnTop = true, ShowItemText = (bool)isItemText.IsChecked, ItemTextFormat = (GraphTextFormat)(setGraphTextFormat.SelectedIndex + 1), ItemCaptions = new List<string>() { "面积", "人口" }, ShowAxes = (bool)isAxes.IsChecked, ShowAxisGrid = (bool)isAxesGrid.IsChecked, MaxSumSize = 100, MinSumSize = 20, }; ThemeParameters parameters = new ThemeParameters() { MapName = "World", Theme = graph, LayerNames = layerNames, ThemeLayer = "World@world" }; ThemeService service = new ThemeService("http://localhost/IS/AjaxDemo"); service.ProcessAsync(parameters); service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed); service.ProcessCompleted += new EventHandler<ThemeEventArgs>(service_ProcessCompleted); }
internal static string ToJson(ThemeGraph param) { if (param == null) { return null; } string json = "{"; List<string> list = new List<string>(); if (param.AxesTextStyle != null) { list.Add(string.Format("\"axesTextStyle\":{0}", ServerTextStyle.ToJson(param.AxesTextStyle))); } else { list.Add("\"axesTextStyle\":null"); } list.Add(string.Format("\"barWidth\":{0}", param.BarWidth)); list.Add(string.Format("\"enableFlow\":{0}", param.EnableFlow.ToString().ToLower())); if (param.Expressions != null) { List<string> temp = new List<string>(); for (int i = 0; i < param.Expressions.Count; i++) { temp.Add(string.Format("\"{0}\"", param.Expressions[i])); } list.Add(string.Format("\"expressions\":[{0}]", string.Join(",", temp.ToArray()))); } else { list.Add("\"expressions\":null"); } list.Add(string.Format("\"graduatedMode\":{0}", (int)param.GraduatedMode)); if (param.GraphStyles != null && param.GraphStyles.Count > 0) { List<string> temp = new List<string>(); for (int i = 0; i < param.GraphStyles.Count; i++) { temp.Add(ServerStyle.ToJson(param.GraphStyles[i])); } list.Add(string.Format("\"graphStyles\":[{0}]", string.Join(",", temp.ToArray()))); } else { list.Add("\"graphStyles\":null"); } list.Add(string.Format("\"graphType\":{0}", (int)param.GraphType)); list.Add(string.Format("\"itemTextFormat\":{0}", (int)param.ItemTextFormat)); if (param.ItemTextStyle != null) { list.Add(string.Format("\"itemTextStyle\":{0}", ServerTextStyle.ToJson(param.ItemTextStyle))); } else { list.Add("\"itemTextStyle\":null"); } list.Add(string.Format("\"lineColor\":{0}", ServerColor.ToJson(param.LineColor))); list.Add(string.Format("\"maxSumSize\":{0}", param.MaxSumSize)); list.Add(string.Format("\"minSumSize\":{0}", param.MinSumSize)); list.Add(string.Format("\"showAxes\":{0}", param.ShowAxes.ToString().ToLower())); list.Add(string.Format("\"showAxesText\":{0}", param.ShowAxesText.ToString().ToLower())); list.Add(string.Format("\"showAxisGrid\":{0}", param.ShowAxisGrid.ToString().ToLower())); list.Add(string.Format("\"showItemText\":{0}", param.ShowItemText.ToString().ToLower())); list.Add(string.Format("\"onTop\":{0}", param.OnTop.ToString().ToLower())); if (param.ItemCaptions != null) { List<string> temp = new List<string>(); for (int i = 0; i < param.ItemCaptions.Count; i++) { temp.Add(string.Format("\"{0}\"", param.ItemCaptions[i])); } list.Add(string.Format("\"itemCaptions\":[{0}]", string.Join(",", temp.ToArray()))); } else { list.Add("\"itemCaptions\":null"); } if (!string.IsNullOrEmpty(param.OffsetXExpression)) { list.Add(string.Format("\"offsetXExpression\":\"{0}\"", param.OffsetXExpression)); } else { list.Add("\"offsetXExpression\":\"\""); } if (!string.IsNullOrEmpty(param.OffsetYExpression)) { list.Add(string.Format("\"offsetYExpression\":\"{0}\"", param.OffsetYExpression)); } else { list.Add("\"offsetYExpression\":\"\""); } list.Add(string.Format("\"offsetFixed\":{0}", param.OffsetFixed.ToString().ToLower())); list.Add(string.Format("\"showXAxisText\":{0}", param.ShowXAxisText.ToString().ToLower())); json += string.Join(",", list.ToArray()); json += ","; json += Theme.AddList(param); json += "}"; return json; }
/// <summary>${IS6_ThemeGraph_method_FromJson_D}</summary> /// <returns>${IS6_ThemeGraph_method_FromJson_return}</returns> /// <param name="jsonObject">${IS6_ThemeGraph_method_FromJson_param_jsonObject}</param> public static ThemeGraph Fromjson(JsonObject jsonObject) { if (jsonObject == null) { return null; } ThemeGraph result = new ThemeGraph { Caption = (string)jsonObject["caption"], Filter = (string)jsonObject["filter"], MaxScale = (double)jsonObject["maxScale"], MinScale = (double)jsonObject["minScale"], ForeignDataParam = ForeignDataParam.FromJson((JsonObject)jsonObject["foreignDataParam"]), AxesTextStyle = ServerTextStyle.FromJson((JsonObject)jsonObject["axesTextStyle"]), EnableFlow = (bool)jsonObject["enableFlow"], GraduatedMode = (GraduatedMode)(int)jsonObject["graduatedMode"], GraphType = (GraphType)(int)jsonObject["graphType"], ItemTextFormat = (GraphTextFormat)(int)jsonObject["itemTextFormat"], ItemTextStyle = ServerTextStyle.FromJson((JsonObject)jsonObject["itemTextStyle"]), LineColor = ServerColor.FromJson((int)jsonObject["lineColor"]), MaxSumSize = (double)jsonObject["maxSumSize"], MinSumSize = (double)jsonObject["minSumSize"], OffsetFixed = (bool)jsonObject["offsetFixed"], OffsetXExpression = (string)jsonObject["offsetXExpression"], OffsetYExpression = (string)jsonObject["offsetYExpression"], OnTop = (bool)jsonObject["onTop"], ShowAxes = (bool)jsonObject["showAxes"], ShowAxesText = (bool)jsonObject["showAxesText"], ShowAxisGrid = (bool)jsonObject["showAxisGrid"], ShowItemText = (bool)jsonObject["showItemText"], ShowXAxisText = (bool)jsonObject["showXAxisText"], }; if (jsonObject.ContainsKey("itemCaptions") && jsonObject["itemCaptions"] != null && jsonObject["itemCaptions"].Count > 0) { result.ItemCaptions = new List<string>(); for (int i = 0; i < jsonObject["itemCaptions"].Count; i++) { result.ItemCaptions.Add((string)jsonObject["itemCaptions"][i]); } } if (jsonObject.ContainsKey("expressions") && jsonObject["expressions"] != null && jsonObject["expressions"].Count > 0) { result.Expressions = new List<string>(); for (int i = 0; i < jsonObject["expressions"].Count; i++) { result.Expressions.Add((string)jsonObject["expressions"][i]); } } if (jsonObject.ContainsKey("graphStyles") && jsonObject["graphStyles"] != null && jsonObject["graphStyles"].Count > 0) { result.GraphStyles = new List<ServerStyle>(); for (int i = 0; i < jsonObject["graphStyles"].Count; i++) { result.GraphStyles.Add(ServerStyle.FromJson((JsonObject)jsonObject["graphStyles"][i])); } } return result; }