${REST_ThemeGraduatedSymbol_Title}

${REST_ThemeGraduatedSymbol_Description}

Inheritance: Theme
        //点击生成专题图触发事件
        private async void commit_Click(object sender, RoutedEventArgs e)
        {
            ThemeGraduatedSymbol themeGraduatedSymbol = new ThemeGraduatedSymbol
            {
                BaseValue = 1128139680,
                GraduatedMode = GraduatedMode.SQUAREROOT,
                Flow = new ThemeFlow
                {
                    FlowEnabled = true,
                },
                Expression = "Pop_1994",
                Style = new ThemeGraduatedSymbolStyle
                {
                    PositiveStyle = new ServerStyle
                    {
                        LineColor = Colors.White,
                        MarkerSize = 20,
                        MarkerSymbolID = 5
                    }

                }
            };
            //专题图参数设置
            ThemeParameters themeGraduatedSymbolParams = new ThemeParameters
            {
                //数据集名称
                DatasetName = "Countries",
                //数据源名称
                DataSourceName = "World",
                Themes = new List<Theme> { themeGraduatedSymbol }
            };
            //与服务器交互
            try
            {
                ThemeService themeGraduatedSymbolService = new ThemeService(url);
                var result = await themeGraduatedSymbolService.ProcessAsync(themeGraduatedSymbolParams);

                //显示专题图。专题图在服务端为一个资源,每个资源都有一个 ID 号和一个 url
                //要显示专题图即将资源结果的 ID 号赋值给图层的 layersID 属性即可
                themeLayer.LayersID = result.ResourceInfo.NewResourceID;
                if (!this.MyMap.Layers.Contains(themeLayer))
                {
                    //加载专题图图层
                    this.MyMap.Layers.Add(themeLayer);
                }
                if (!themeLayer.IsVisible)
                {
                    themeLayer.IsVisible = true;
                }
            }
            //与服务器交互失败
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        internal static string ToJson(ThemeGraduatedSymbol graduatedSymbolTheme)
        {
            string json = "{";
            List<string> list = new List<string>();

            list.Add(string.Format("\"baseValue\":{0}", graduatedSymbolTheme.BaseValue.ToString()));

            if (!string.IsNullOrEmpty(graduatedSymbolTheme.Expression))
            {
                list.Add(string.Format("\"expression\":\"{0}\"", graduatedSymbolTheme.Expression));
            }
            else
            {
                list.Add("\"expression\":\"\"");
            }

            list.Add(string.Format("\"graduatedMode\":\"{0}\"", graduatedSymbolTheme.GraduatedMode.ToString()));

            if (graduatedSymbolTheme.Offset != null)
            {
                list.Add(ThemeOffset.ToJson(graduatedSymbolTheme.Offset));
            }
            else 
            {
                list.Add("\"offsetX\":\"\"");
                list.Add("\"offsetY\":\"\"");
            }

            if (graduatedSymbolTheme.Style != null)
            {
                list.Add(ThemeGraduatedSymbolStyle.ToJson(graduatedSymbolTheme.Style));
            }
            else
            {
                list.Add(string.Format("\"positiveStyle\":{0}", ServerStyle.ToJson(new ServerStyle())));
                list.Add(string.Format("\"negativeStyle\":{0}", ServerStyle.ToJson(new ServerStyle())));
                list.Add(string.Format("\"zeroStyle\":{0}", ServerStyle.ToJson(new ServerStyle())));
            }

            if (graduatedSymbolTheme.Flow != null)
            {
                list.Add(ThemeFlow.ToJson(graduatedSymbolTheme.Flow));
            }
            else
            {
                list.Add(string.Format("\"leaderLineStyle\":{0}", ServerStyle.ToJson(new ServerStyle())));
            }

            if (graduatedSymbolTheme.MemoryData != null)
            {
                list.Add("\"memoryData\":" + graduatedSymbolTheme.ToJson(graduatedSymbolTheme.MemoryData));
            }
            else
            {
                list.Add("\"memoryData\":null");
            }
            list.Add("\"type\":\"GRADUATEDSYMBOL\"");

            json += string.Join(",", list.ToArray());
            json += "}";
            return json;
        }
 internal static ThemeGraduatedSymbol FromJson(JsonObject json)
 {
     if (json == null) return null;
     ThemeGraduatedSymbol graduatedSymbol = new ThemeGraduatedSymbol();
     graduatedSymbol.BaseValue = json["baseValue"].GetNumberEx();
     graduatedSymbol.Expression = json["expression"].GetStringEx();
     graduatedSymbol.Flow = ThemeFlow.FromJson(json);
     if (json["graduatedMode"].ValueType != JsonValueType.Null)
     {
         graduatedSymbol.GraduatedMode = (GraduatedMode)Enum.Parse(typeof(GraduatedMode), json["graduatedMode"].GetStringEx(), true);
     }
     else
     {
         //这里不处理为空时的情况
     }
     graduatedSymbol.Offset = ThemeOffset.FromJson(json);
     graduatedSymbol.Style = ThemeGraduatedSymbolStyle.FromJson(json.GetObject());
     return graduatedSymbol;
 }