GShape.ImageShape.setAlignment(value)

Specifies how the image should be aligned relative to the data point it marks.

Parameter

value

One of the following constants:

GShape.ImageShape.Alignment.CENTER
GShape.ImageShape.Alignment.TOP
GShape.ImageShape.Alignment.RIGHT

Example

Chart Component Script
dataset = [["State", "Quantity"], ["NJ", 200], ["NY", 300]]; (1)
graph = new EGraph();
var elem = new PointElement("State", "Quantity");
var logo = getImage("https://www.inetsoft.com/images/home/logo.gif");
var shape = new GShape.ImageShape(); (2)
shape.setImage(logo); (3)
shape.setAlignment(GShape.ImageShape.Alignment.TOP); (4)
var frame = new CategoricalShapeFrame("State");
for(var i=0; i<dataset.getRowCount();i++) {
  frame.setShape(dataset.getData(0,i),shape); (5)
}
elem.setShapeFrame(frame); (6)
var sizeframe = new StaticSizeFrame(100);
elem.setSizeFrame(sizeframe);
graph.addElement(elem);
1 See dataset to use a data block instead of an array literal.
2 Create the GShape.ImageShape shape.
3 Use GShape.ImageShape.setImage(image) to assign the desired image to the shape.
4 Use setAlignment() to set top-alignment.
5 Use StaticShapeFrame.setShape(shape) to assign the shape to the data.
6 Use GraphElement.setShapeFrame(frame) to add the ShapeFrame to the IntervalElement.

GShapeImageShapeAlignment

Script that modifies the graph or dataset properties should be placed on the Chart component itself. See Add Component Script for more information. This script has access to the Chart data and Chart API methods. Scripted Charts are not good candidates for user-modification, so you should deselect ‘Enable Ad Hoc Editing’ in the Chart Properties dialog box.

To change the property on a Chart that was previously created with the Chart Editor, use “getter” methods such as EGraph.getElement(index) ① and GraphElement.getShapeFrame() ② to obtain a handle to the desired GraphElement object and ShapeFrame object. For example:

var elem = graph.getElement(0); (1)
var frame = elem.getShapeFrame(); (2)
var logo = getImage("https://www.inetsoft.com/images/home/logo.gif");
var shape = new GShape.ImageShape();
shape.setImage(logo);
shape.setAlignment(GShape.ImageShape.Alignment.TOP);
for(var i=0; i<dataset.getRowCount();i++) {
  frame.setShape(dataset.getData(0,i),shape);
}