Looking for an online chart generator? Since 1996, InetSoft has been offering free and commercial charting and reporting tools. View a demo and try then for free.
Style Intelligence is a commercial business intelligence software package for enterprise chart generation and real-time access to almost any data source. This software is also well-suited for developers to embed into other applications, on-premise or SaaS-based.
Type
value An [X,Y] pair
Example (Report or Viewsheet)
importPackage(inetsoft.graph) importPackage(inetsoft.graph.element) importPackage(inetsoft.graph.scale) importPackage(inetsoft.graph.aesthetic) importPackage(inetsoft.graph.data) importPackage(inetsoft.graph.coord) importPackage(inetsoft.graph.guide.form) var arr = [["State", "Quantity"], ["NJ", 200], ["NY", 300]]; dataset = new DefaultDataSet(arr); graph = new EGraph(); var rect = new RectForm(); rect.setTopLeftTuple([1,200]); rect.setBottomRightTuple([2,50]); rect.setColor(java.awt.Color(0xff0000)); graph.addForm(rect); graph.addElement(new IntervalElement("State", "Quantity"));
Specifies the point in logical space for the top left corner of the rectangle. The coordinates of the point are relative to prevailing axis scaling prior to transformation. So, for a categorical X-axis (e.g., 'NJ', 'NY', 'PA', etc.), the X-value of topLeftValues should specify a categorical value (e.g., 'NJ').
Type
value an [X,Y] pair
Example (Report or Viewsheet)
importPackage(inetsoft.graph) importPackage(inetsoft.graph.element) importPackage(inetsoft.graph.scale) importPackage(inetsoft.graph.aesthetic) importPackage(inetsoft.graph.data) importPackage(inetsoft.graph.coord) importPackage(inetsoft.graph.guide.form) var arr = [["State", "Quantity"], ["NJ", 200], ["NY", 300]]; dataset = new DefaultDataSet(arr); graph = new EGraph(); var rect = new RectForm(); rect.setTopLeftValues(['NJ',200]); rect.setBottomRightValues(['NY',50]); ect.setColor(java.awt.Color(0xff0000)); graph.addForm(rect); graph.addElement(new IntervalElement("State", "Quantity"));
Specifies the vertical alignment of the label with respect to the specified Y location.
Values
GraphConstants.TOP_ALIGNMENT GraphConstants.MIDDLE_ALIGNMENT GraphConstants.BOTTOM_ALIGNMENT
Example (Report or Viewsheet)
importPackage(inetsoft.graph) importPackage(inetsoft.graph.element) importPackage(inetsoft.graph.scale) importPackage(inetsoft.graph.aesthetic) importPackage(inetsoft.graph.data) importPackage(inetsoft.graph.coord) importPackage(inetsoft.graph.guide.form) var arr = [["State","Quantity"], ["NJ",200], ["NY",300]]; dataset = new DefaultDataSet(arr); graph = new EGraph(); var elem = new IntervalElement("State", "Quantity"); var form1 = new LabelForm(); var form2 = new LabelForm(); form1.setLabel("label1"); form1.setPoint(new java.awt.Point(100, 100)); form2.setLabel("label2"); form2.setPoint(new java.awt.Point(100, 100)); form2.setAlignmentY(GraphConstants.TOP_ALIGNMENT); graph.addForm(form1); graph.addForm(form2); graph.addElement(elem);
Specifies how collisions (labels occupying the same location) should be handled.
Values
GraphElement.MOVE_NONE // no stacking or centering GraphElement.MOVE_CENTER // center on value, no stacking GraphElement.MOVE_DODGE // offset horizontally GraphElement.MOVE_STACK // offset vertically (stack) GraphElement.MOVE_JITTER // random offset (point chart) GraphElement.DODGE_SYMMETRIC // offset horizontally, center GraphElement.STACK_SYMMETRIC // offset vertically, center
Example (Report or Viewsheet)
importPackage(inetsoft.graph) importPackage(inetsoft.graph.data) importPackage(inetsoft.graph.element) importPackage(inetsoft.graph.aesthetic) importPackage(inetsoft.graph.scale) importPackage(inetsoft.graph.coord) importPackage(inetsoft.graph.guide.form) var arr = [["State","Quantity"], ["NJ",200], ["NY",300]]; dataset = new DefaultDataSet(arr); graph = new EGraph(); var elem = new IntervalElement("State", "Quantity"); var form1 = new LabelForm(); var form2 = new LabelForm(); form1.setLabel("label1"); form1.setValues(['NY', 100]); form2.setLabel("label2"); form2.setValues(['NY', 100]); form1.setCollisionModifier(GraphElement.STACK_SYMMETRIC); graph.addForm(form1); graph.addForm(form2); graph.addElement(elem);
Specifies the padding in pixels surrounding the label text.
Type
value a java.awt.Insets object
Example (Report or Viewsheet)
importPackage(inetsoft.graph) importPackage(inetsoft.graph.data) importPackage(inetsoft.graph.element) importPackage(inetsoft.graph.aesthetic) importPackage(inetsoft.graph.scale) importPackage(inetsoft.graph.coord) importPackage(inetsoft.graph.guide.form) var arr = [["State","Quantity"], ["NJ",200], ["NY",300]]; dataset = new DefaultDataSet(arr); graph = new EGraph(); var elem = new IntervalElement("State", "Quantity"); var form = new LabelForm(); form.setLabel("label1"); form.setValues(['NY', 100]); var spec = new TextSpec(); spec.setBackground(java.awt.Color(0x00ff00)); form.setTextSpec(spec); form.setInsets(new java.awt.Insets(0,15,0,15)); // Argument order: top,left,bottom,right graph.addForm(form); graph.addElement(elem);
Specifies the text of the label. (Use “\n” to insert newline.)
Type
value a String containing label text
Example (Report or Viewsheet)
importPackage(inetsoft.graph) importPackage(inetsoft.graph.data) importPackage(inetsoft.graph.element) importPackage(inetsoft.graph.aesthetic) importPackage(inetsoft.graph.scale) importPackage(inetsoft.graph.coord) importPackage(inetsoft.graph.guide.form) var arr = [["State", "Quantity"], ["NJ", 200], ["NY", 300]]; dataset = new DefaultDataSet(arr); graph = new EGraph(); var elem = new IntervalElement("State", "Quantity"); var form = new LabelForm(); form.setLabel("Hello\nWorld"); form.setValues(['NY', 100]); graph.addForm(form); graph.addElement(elem);
Specifies the pixel location (integer values) or proportional location (fractional values) for the label. (Positive values specify distance from left/bottom. Negative values specify distance from right/top.)
Type
value a subclass of java.awt.geom.Point2D e.g., java.awt.Point for pixels java.awt.geom.Point2D.Double for proportion
Example (Report or Viewsheet)
Bind a line-type chart to the sample 'All Sales' query, with 'Company' (top 5) on the X-axis, and Sum(Total) on the Y-axis. Add the following script in the onLoad Handler.
importPackage(inetsoft.graph) importPackage(inetsoft.graph.element) importPackage(inetsoft.graph.scale) importPackage(inetsoft.graph.aesthetic) importPackage(inetsoft.graph.data) importPackage(inetsoft.graph.coord) importPackage(inetsoft.graph.guide.form) var arr = [["State", "Quantity"], ["NJ", 200], ["NY", 300]]; dataset = new DefaultDataSet(arr); graph = new EGraph(); var elem = new IntervalElement("State", "Quantity"); var form1 = new LabelForm(); var form2 = new LabelForm(); form1.setLabel("label1"); form2.setLabel("label2"); // Set form1 points in pixels: form1.setPoint(new java.awt.Point(50, 100)); // Set form2 points proportionally: form2.setPoint(new java.awt.geom.Point2D.Double(.5,.7)); graph.addForm(form1); graph.addForm(form2); graph.addElement(elem);
Previous: Create a Graph |
Next: Create a Chart
|