Changing the Appearance of a Dashboard Chart via the API

You can change the static appearance of dashboard chart elements by using a static VisualFrame. For example, you can set static colors, sizes, and textures to enhance the aesthetic appearance of a chart.

Consider the script below:

View 2-min Dashboard Demo
Register for Pricing
#1 Ranking: Read how InetSoft was rated #1 for user adoption in G2's user survey-based index Read More

 importPackage(inetsoft.graph)
 importPackage(inetsoft.graph.element)
 importPackage(inetsoft.graph.scale)
 importPackage(inetsoft.graph.aesthetic)
 importPackage(inetsoft.graph.data)
   var arr = [["State","Quantity","Total"],
            ["NJ",200,2500],["NY",300,1500]];
 dataset = new DefaultDataSet(arr);
 graph = new EGraph();
 var elem = new PointElement("State", "Quantity");
 graph.addElement(elem);

This creates a basic point (scatter) chart displaying the dimensions 'State' and 'Quantity'. However, the points are rather small and hard to see. To increase the size of the points and assign them a bolder color, use a StaticColorFrame and a StaticSizeFrame.

Follow these steps:

1. Create a new StaticColorFrame object, and specify a static color (red).

 var cframe = new StaticColorFrame(); 
 cframe.setColor(java.awt.Color(0xff0000));// red 

2. Create a new StaticSizeFrame object, and specify a static size.

 var sframe = new StaticSizeFrame(); 
 sframe.setSize(10); 

3. Assign the StaticColorFrame and StaticSizeFrame objects to the GraphElement

 object. elem.setColorFrame(cframe);
 elem.setSizeFrame(sframe);

The complete script is shown below. The points are now large and red.

 importPackage(inetsoft.graph)
 importPackage(inetsoft.graph.element)
 importPackage(inetsoft.graph.scale)
 importPackage(inetsoft.graph.aesthetic)
 importPackage(inetsoft.graph.data)
   var arr = [["State","Quantity","Total"],
            ["NJ",200,2500],["NY",300,1500]];
 dataset = new DefaultDataSet(arr);
 graph = new EGraph();
 var elem = new PointElement("State", "Quantity");
 var cframe = new StaticColorFrame();
 cframe.setColor(java.awt.Color(0xff0000));
 // red var sframe = new StaticSizeFrame();
 sframe.setSize(10);
 elem.setColorFrame(cframe);
 elem.setSizeFrame(sframe);
 graph.addElement(elem);

Because these are static VisualFrames, the color and size are not keyed to the data. To represent data values using color, size, or other visual attributes, see Representing Data with Shape, Color, Size.

More Articles About Dashboard Charts

Are Data Warehouses Still Necessary? - The Value of Data Warehouses: Data warehouses serve several vital functions that make them an essential component in many organizations: Data Integration and Consolidation: They are designed to aggregate data from various sources, transforming it into a consistent format. This is particularly crucial in organizations with diverse data sets from different departments or systems...

Baggage Handling System KPIs - Key Performance Indicators (KPIs) play a crucial role in assessing the efficiency and effectiveness of an Airport Baggage Handling System (BHS). These metrics help airport authorities and management ensure smooth operations, enhance passenger satisfaction, and maintain overall system reliability. Here are some significant KPIs for an Airport Baggage Handling System: Baggage Processing Time: Definition: The total time it takes for a passenger's checked baggage to travel from the check-in counter to the aircraft loading area...

InetSoft's Customer Analytics Software - When running a business, it is important to maintain positive relationships with customers. Customers expect nothing less than reliable, high-quality interactions when associating with a business. Marketers must understand their customers in order to fully satisfy their needs. One of the best ways to achieve this is through the strategic use of customer data and analytics. With this informative data, companies can create relevant customer experiences and foster long term relationships...

Provide ETL or ETL Capabilities - InetSoft's solution has built-in data block technology that transforms data and produces a high performance cache. This can be used in place of an external ETL tool...

Style Intelligence's Embedded BI Capabilities - Since Style Intelligence is a web-based, Java application, it can be naturally integrated into any program that utilizes java, for dashboards, visualizations, and reports which can be freely viewed and manipulated on any web browser. Furthermore, embedding Style Intelligence will also allow any businesses' dashboards and reports to be accessible on mobile devices, or through any browser, including FireFox, Safari, and Google Chrome. This is a solution which can not only enhance your current software's functionality, but also give users the convenience to access their data and visual analytics anywhere, at any time...

Previous: Executive Dashboard API