new SuperMap.Feature.Theme.RankSymbol(data, layer, fields, setting, lonlat)
Base class of symbol theme, which defines the basic model. The detailed symbol model must inherit from this base class and realize the assembleShapes method in child class. The symbol theme model uses the visual graphic size adaptive strategies, with fewer parameters controlling many types of charts. The chart configuration object <SuperMap.Feature.Theme.RankSymbol::setting> contains five basic attributes which control a graph structure, range, decimal number, etc. The graph in the graph theme must be adapted to the size of the graph structure. The class can't be instantiated. Its child class can be instantiated, but must realize the assembleShapes() method.
Name | Type | Description |
---|---|---|
data |
SuperMap.Feature.Vector |
User data. |
layer |
SuperMap.Layer.RankSymbol |
The layer the theme element is in. |
fields |
Array.<string> |
Field name in the data for creating the graph. |
setting |
Object |
Graph configuration parameter. |
lonlat |
SuperMap.LonLat |
optional
Location of thematic elements. Default is the bounds center of the geographical element. |
Extends
Members
-
chartBoundsSuperMap.Bounds
-
The bounds of the chart will be updated with lonlat, XOffset and YOffset, note: chartBounds is pixel range, not geographical range.
-
chartBoxArray.<number>
-
The thematic feature (chart) area, that is, the chart box, a one-dimensional array of length 4, the four elements of the array sequentially represent the x coordinate value at the left end of the chart frame, the lower y coordinate value, the right end x coordinate value, and the upper y coordinate value; [left , bottom, right, top].
-
dataObject
-
{ReadOnly} User data, used to generate visible shape, and can define data format and type in the sub class. e.g.: <SuperMap.Feature.Vector> 。
-
dataValuesArray.<number>
-
Data values for representation, got by fields from the property of feature.
-
dataViewBoxArray.<number>
-
Data view frame parameters, an array with the length of 4(array element value >= 0), [left, bottom, right, top]. DataViewBox is the core content of the graph theme element. It is responsible for the interpretation of data visualization in a pixel region for the data, and the meaning is expressed by visual graphic. The graphics which represent the data and some auxiliary graphics are combined together to form a statistical thematic charts.
-
DVBCenterPointArray.<number>
-
Center of the data view frame, an array with the length of 2, the first one means x, the second one means y.
-
DVBCodomainArray.<number>
-
Data domain to show in the data view frame, an array with the length of 2, the first one means the minimum, the second one means the maximum. The processing for the data out of the range should be in assembleShapes.
-
DVBHeightnumber
-
Height of the data view frame.
-
DVBOrigonPointArray.<number>
-
Origin point of the data view frame, that is the upper left corner point, an array with the length of 2, the first one means x, the second one means y.
-
DVBParameterArray.<number>
-
Data view frame parameters, an array with the length of 4(array element value >= 0), [leftOffset, bottomOffset, rightOffset, topOffset], the inner offset value of chartBox. The property is used to specify the range of dataViewBox.
-
DVBUnitValuestring
-
Unit value. Initialized in assembleShapes(), e.g.:DVBUnitValue of the pie chart is ”360/data count value”, DVBUnitValue of the line chart is “DVBCodomain/DVBHeight”.
-
DVBWidthnumber
-
Width of the data view frame.
-
fieldsArray.<string>
-
The data {SuperMap.Feature.Vector} attribute fields.
-
heightnumber
-
Height of the theme elements(chart), required.
-
idstring
-
Unique identification of thematic elements
-
layerSuperMap.Layer.Theme
-
{ReadOnly} Thematic layer where thematic features are.
-
locationArray
-
Thematic feature pixel reference position. In general, it is determined by geographic reference. It is an array, the first element is x coordinate, and the second element is y coordinate.
-
lonlatSuperMap.LonLat
-
Thematic feature geographic reference position. In sub class, it is assigned by user data (or geographic position parameter).
-
origonPointArray.<number>
-
Origin point of the theme elements(chart), that is the upper left corner point, an array with the length of 2, the first one means x, the second one means y.
-
origonPointOffsetArray.<number>
-
The origin offset of the data view box relative to the chart box is 2 dimensional array, the first element represents the X offset, and the second element represents the Y offset.
-
RelativeCoordinateboolean
-
Whether the figure has been calculated for the relative coordinates.
-
settingObject
-
Symbol configuration object, which controls the visual display of the graph. It contains five properties:
-
shapeFactorySuperMap.Feature.ShapeFactory
-
The embedded shape factory object, call its createShape method to create shapes.
-
shapeParametersObject
-
The current shape parameter object, the subclass object of <SuperMap.Feature.ShapeParameters>.
-
shapesArray
-
{ReadOnly} The visible shape array by thematic features. The order of the array controls the render.
-
widthnumber
-
Width of the theme elements(chart), required.
-
XOffsetnumber
-
Offset in X direction of the theme elements(chart), the unit is pixel.
-
YOffsetnumber
-
Offset in Y direction of the theme elements(chart), the unit is pixel.
Methods
-
inherited assembleShapes()
Graph.js, line 412 -
assembleShapes. Abstract methods, the visual child class must implement this method.
To rewrite the method, please follow the steps:1. Process some special configuration(setting). e.g., the dataViewBoxParameter default value should be set for most graphic models.<br> 2. Call initBaseParameter() to initialize the model property value. This step must be performed. The following steps can be performed only when initBaseParameter returns true.<br> 3. Calculate graph parameters, make graphics and graphic combination. In the assembly process of diagram, you should pay special attention to the definition of the unit values in data view frame, processing for the data out of range, and graphic size adaptive.<br> 4. Call shapesConvertToRelativeCoordinate() method to convert graphics coordinate values to the relative coordinates, and this step must be performed.
Example
//Sample to realize the assembleShapes() interface in child class: assembleShapes: function(){ // 1.Process some special configuration(setting). e.g., the dataViewBoxParameter default value should be set for most graphic models. Optional. // Graph configuration object var sets = this.setting; // The default data view box, which displays different default values for the data view box parameters in the case of the use of the coordinate axis and without the use of a coordinate axis. if(!sets.dataViewBoxParameter){ if(typeof(sets.useAxis) === "undefined" || sets.useAxis){ sets.dataViewBoxParameter = [45, 15, 15, 15]; } else{ sets.dataViewBoxParameter = [5, 5, 5, 5]; } } // 2. Initialize the basic parameters of chart model, only when the basic parameters are initialized successfully, other properties can be set, e.g, this.dataViewBox, this.DVBCodomain. Required. if(!this.initBaseParameter()) return; // 3. Make graphics and graphic combination. In the assembly process of diagram, you should pay special attention to the definition of the unit values in data view frame, processing for the data out of range, and graphic size adaptive. // Definition of the unit in the chart data view, below will define the unit as the pixel value of the height of the data view frame. this.DVBUnitValue = (this.codomain[1] - this.codomain[0])/this.DVBHeight; var uv = this.DVBUnitValue; // Calculate graph parameters...... // The assembly graph is to use the createShape () method of the engineering graphics object this.shapeFactory to create visual graphic objects,. //and add the graph objects sequentially to the graphics library(his.shapes). The following code demonstrates creating a region graphical parameter object, and setting the style and highlightStyle of the graph. var barParams = new SuperMap.Feature.ShapeParameters.Polygon(poiLists); barParams.style = sets.barStyle? sets.barStyle:{fillColor: "lightblue"}; barParams.highlightStyle = sets.barHoverStyle? sets.barHoverStyle:{fillColor: "blue"}; // ID of graph related data barParams.refDataID = this.data.id; // Create graph and add it to array this.shapes.push(this.shapeFactory.createShape(barParams)); // 4 Call shapesConvertToRelativeCoordinate(), convert the graph in his.shapes to relative coordinates, which is needed by the client graph them module. // Call shapesConvertToRelativeCoordinate() with assembleShapes() only after the shapes are combined. Required. this.shapesConvertToRelativeCoordinate(); },
-
inherited constructor(data, layer){SuperMap.Feature.Theme}
Theme.js, line 14 -
The Constructor.
Name Type Description data
Object User data which is used to generate visible shape. Required.
layer
SuperMap.Layer.Theme The layer the theme element is in, required.
Returns:
Type Description SuperMap.Feature.Theme Return a thematic feature. -
destroy()
RankSymbol.js, line 46 -
Destroys thematic features.
-
inherited getLocalXY(lonlat)
Graph.js, line 465 -
The geographic coordinates are converted to pixel coordinates.
Name Type Description lonlat
SuperMap.Lonlat The geographical coordinates to be converted.
Returns:
Screen pixel coordinates. -
initBaseParameter(codomain, XOffset, YOffset, dataViewBoxParameter, decimalNumber){boolean}
RankSymbol.js, line 56 -
Initialize the basic parameters of the theme element (graph). Before calling this method, the graph model related properties are not available, this method is called in the assembleShapes function. The related properties of the setting object are:
Name Type Description codomain
Array.<number> Domain, an array with the length of 2, the first one is the minimum, the second one is the maximum value.
XOffset
number optional Offset in X direction of the theme elements(graph), the unit is pixel.
YOffset
number optional Offset in Y direction of the theme elements(graph), the unit is pixel.
dataViewBoxParameter
Array.<number> optional The data view frame dataViewBox parameters, means four inner offset values in left, down, right, up direction of chartBox( constituted by chart position, chart width, chart height).
decimalNumber
number optional The decimal value of the data value array dataValues, decimal processing parameters, the range is: [0, 16]. If you do not set this parameter, the decimal will not be processed.
Returns:
Type Description boolean Whether the initialization is successful. -
inherited resetLinearGradient()
Graph.js, line 367 -
When the relative coordinates of the chart are called in the resetLocation, the color of the gradient is recalculated.(The subclass implements this method at present for the gradient color of a two-dimensional histogram)
-
inherited resetLocation(lonlat){Array.<number>}
Graph.js, line 336 -
The location of the thematic element (Chart) is reset according to the geographic location lonlat.
Name Type Description lonlat
SuperMap.LonLat The new pixel center position of the feature element.
Returns:
Type Description Array.<number> - New feature element pixel reference position. The length of an array is 2, the first element to represent the X coordinates, the second elements to represent the Y coordinates.
-
inherited shapesConvertToRelativeCoordinate()
Graph.js, line 375 -
The node that will (constitute a graph) is converted to relative coordinates, which must be called at the end of the assembleShapes ().