Class: ThemeGraph

SuperMap.ThemeGraph

The ThemeGraph class.

new SuperMap.ThemeGraph(options)

ThemeGraph.js, line 13
Name Type Description
options Object

The parameters.

Name Type Default Description
items Array.<SuperMap.ThemeGraphItem>

The ThemeGraphItem collection.

barWidth number 0 optional

The width of each column in the column map.

flow SuperMap.ThemeFlow optional

The flow display and leader line setting class of the ThemeGraph.

graduatedMode SuperMap.GraduatedMode SuperMap.GraduatedMode.CONSTANT optional

The mapping relationship between the feature values and the size of charts in the graph map.

graphAxes SuperMap.ThemeGraphAxes optional

The style-related information of the axes in the graph map.

graphSize SuperMap.ThemeGraphSize 0 optional

The minimum and maximum size of the statistical symbol.

graphSizeFixed boolean false optional

Whether to fix the size of the symbols when the map zooms.

graphText SuperMap.ThemeGraphText optional

Whether the text in the graph map is visible, and the text label style.

graphAxesTextDisplayMode SuperMap.GraphAxesTextDisplayMode SuperMap.GraphAxesTextDisplayMode.NONE optional

The graph thematic map text display mode.

graphType SuperMap.ThemeGraphType SuperMap.ThemeGraphType.AREA optional

ThemeGraphType.

memoryKeys Array.<number> optional

The key array when making the thematic map by the way of the memory array.

negativeDisplayed boolean false optional

Whether to show the data whose attribute is negative value in the thematic map.

offset SuperMap.ThemeOffset optional

The offset of the graph map relative to the point-in-feature.

overlapAvoided boolean true optional

Whether to display the graph map by the way of avoidance.

roseAngle number 0 optional

The rose and the 3D rose in the graph map are used for the angles with equal portion.

startAngle number 0 optional

The startAngle of the wedge in the pie.

Extends

Members

barWidthnumber

The width of each column in the column map. It is in map coordinate unit, Only the selected graph map type is the column (column, 3D column, stacked column, 3D Stacked Column), this item can be set.

The flow display and leader line setting class of the ThemeGraph. This field can be used to set whether the graph symbols are the flow display and leader line style.

graduatedModeSuperMap.GraduatedMode

The classification method of the graph thematic map. It shows the mapping relationship between the feature values and the size of charts. Classification is mainly used for decreasing the difference in value field. If the difference is very large, you can use logarithm or square root to rank, which will decrease the absolute difference and make a good visual effect of map. There are three classification methods: constant, logarithm and square root. To those negative field, the logarithm and square root cannot be used. Different classification modes have different values to determine the size of symbols.

Default Value:
SuperMap.GraduatedMode.CONSTANT

Used to set the style-related information of the axes in the graph map, such as the axes color, whether to display, the coordinate text style, etc.

graphAxesTextDisplayModeSuperMap.GraphAxesTextDisplayMode

The graph thematic map text display mode.

Default Value:
SuperMap.GraphAxesTextDisplayMode.NONE

Used to set the minimum and maximum size of the statistical symbol.

graphSizeFixedboolean

Whether to fix the size of the symbols when the map zooms.

Whether the text in the graph map is visible, and the text label style.

ThemeGraphType. SuperMap Objects supports multiple graphs including Area, Graduated Symbol, Line, Scatter Point, Column, 3D Column, Pie, 3D Pie, Rose, Stacked Column, 3D Stacked Column and Doughnut etc.

Default Value:
SuperMap.ThemeGraphType.AREA

The ThemeGraphItem class. More than one thematic variable can be displayed in each graph. The graph map corresponding to each thematic variable is a thematic map item. This class is used to set the title, the thematic variable and the display style of each graph map item, and even make this item into a ThemeRange again.

The ThemeMemoryData
The way of making thematic maps with the ThemeMemoryData and the ways of making thematic maps are mutually exclusive, the former has higher priority。 The first parameter represents the thematic value, that is, the data set is used to do the values of the fields or expressions of the thematic graph. The second parameters represent the external values. In the production of a thematic map, the external value is used instead of the topic value to make the corresponding thematic maps.

memoryKeysArray.<number>

The key array when making the thematic map by the way of the memory array.
The values in the key array represent the SmID value, It applies when associating the value array (ThemeGraphItem.memoryDoubleValues) in the ThemeGraphItem class.
The number of values in the key array must be the same as that in the value array. The values in the value array will replace the original thematic values to make graph map.
Now all the thematic maps support making the thematic maps by the way of memory array, but the memory array method specified by the graph maps is different with other thematic maps.
The thematic maps use memoryKeys to specify the memory array, while other thematic maps use the memoryData.

Example
The usage of memoryKeys is as following:
  function addThemeGraph() {
     removeTheme();
       //Create graph thematic map object, ThemeGraph required items.
      //The ThemeParameters: theme, dataSourceName and datasetName are required.
     var style1 = new SuperMap.ServerStyle({
                  fillForeColor: new SuperMap.ServerColor(92,73,234),
                  lineWidth: 0.1
              }),
              style2 = new SuperMap.ServerStyle({
                  fillForeColor: new SuperMap.ServerColor(211,111,240),
                  lineWidth: 0.1
              }),
              item1 = new SuperMap.ThemeGraphItem({
                  memoryDoubleValues:[1.18,0.95,0.37,1.31,0.8,1.5],
                 caption: "1992-1995 population growth rate",
                 graphExpression: "Pop_Rate95",
                  uniformStyle: style1
              }),
              item2 = new SuperMap.ThemeGraphItem({
              //The memory array for saving theme values
                  memoryDoubleValues:[2.71,0,0.74,3.1,2.2,3.5],
                  caption: "1995-1999 population growth rate",  //Name of theme item
                  graphExpression: "Pop_Rate99",  //The theme graph expression
                  uniformStyle: style2      //Style of this theme item
              }),
              themeGraph  = new SuperMap.ThemeGraph({
              //The memory key array for theme, value in the array mean SmID value.
                   memoryKeys:[1,2,4,8,10,12],
                  items: new Array(item1,item2),
                  barWidth: 0.03,
                   //The mappings between geographic features in graph map and chart size is square root
                  graduatedMode: SuperMap.GraduatedMode.SQUAREROOT,
                  //graphAxes is used to set the axis style information in graph map
                  graphAxes: new SuperMap.ThemeGraphAxes({
                      axesDisplayed: true
                  }),
                  graphSize: new SuperMap.ThemeGraphSize({
                      maxGraphSize: 1,
                      minGraphSize: 0.35
                  }),
                  //Whether the texts in graph map is visible and the text style
                  graphText: new SuperMap.ThemeGraphText({
                      graphTextDisplayed: true,
                      graphTextFormat: SuperMap.ThemeGraphTextFormat.VALUE,
                      graphTextStyle: new SuperMap.ServerTextStyle({
                          sizeFixed: true,
                          fontHeight: 9,
                          fontWidth: 5
                      })
                  }),
                  //The theme graph type
                  graphType: SuperMap.ThemeGraphType.BAR3D
              }),
              //The theme graph parameter object
              themeParameters = new SuperMap.ThemeParameters({
                  themes: [themeGraph],
                  dataSourceNames: ["Jingjin"],
                  datasetNames: ["BaseMap_R"]
              }),
             //Communication with the server
              themeService=new SuperMap.ThemeService(url, {
                  eventListeners: {
                      "processCompleted": ThemeCompleted,
                       "processFailed": themeFailed
                 }
             });
      themeService.processAsync(themeParameters);
  }

negativeDisplayedboolean

Whether to show the data whose attribute is negative value in the thematic map. true means to display.

Used to set the offset of the graph map relative to the point-in-feature.

overlapAvoidedboolean

Whether to display the graph map by the way of avoidance.
1.Make the graph map for the dataset: when display the graph map by the way of avoidance, if the overlapAvoided is true, when the overlap of the graph map is great, the overlap couldn’t be avoided completely; If the overlapAvoided is false, some of the graph maps will be filtered out to make sure all the graph maps won’t overlap.
2.Make the graph map and the label map for the dataset at the same time: when the graph map doesn't show the item text, even if the labels of the label map overlap with the graph map, both of them can be displayed normally; when the graph map shows the item text, if the item text in the graph map and the label in the label map don't overlap, both are displayed normally; if overlapping, the item text of the graph map would be filtered out, the label will be displayed only.

roseAnglenumber

The rose and the 3D rose in the graph map are used for the angles with equal portion, the default is 0 degree, it’s accurate to 0.1 degree.When the angle is 0 or greater than 360 degree, the 360 degree is used to equally divide the ranges which are used to make the graph maps.

startAnglenumber

The Start Angle of the wedge in the pie. it’s accurate to 0.1 degree, and the horizontal direction is positive. Only the graph map type is selected to be pie (pie, 3D pie, rose, 3D rose), this item can be set.

typestring

type of the thematic mapping.

Methods

SuperMap.ThemeGraph.fromObj(obj){SuperMap.ThemeGraph}

ThemeGraph.js, line 331

Obtaining statistical thematic map classes from the incoming object.

Name Type Description
obj Object

the incoming object.

Returns:
Type Description
SuperMap.ThemeGraph ThemeGraph object.

inherited destroy()

Theme.js, line 41

Disposes the resource. The property that references resource is set to null.

inherited destroy()

Theme.js, line 41

Disposes the resource. The property that references resource is set to null.

toJSON(){string}

ThemeGraph.js, line 274

Transform the SuperMap.ThemeGraph object to the JSON string.

Returns:
Type Description
string The JSON string.

toServerJSONObject(){Object}

ThemeGraph.js, line 283

Turned to the JSON format object.

Returns:
Type Description
Object The JSON object