Modifying a Chart Data Binding

The bindingInfo property of a Chart provides access to the data binding options in the Chart's 'Data Binding' dialog box. This includes the binding of fields to the X-axis, Y-axis, and VisualFrames (Color, Shape, etc.), as well as grouping and summarization settings.

In the following example, you will bind a chart to the 'All Sales' query, set the axis bindings, define a subseries, and set grouping and summarization. Follow the steps below:

1. Add a new Chart element to the report.

For this example, do not open the 'Data Binding' dialog box. In the following steps, you will set the data source through the Chart's “query” property. In general, it does not matter how you initially con­figure the data binding, whether in script or through the 'Data Bind­ing' dialog box. In either case, you can use the bindingInfo properties in script to modify the data binding.

2. Right-click an empty area of the report, and select 'Script' from the context menu. This opens the Script Editor for editing the onLoad Handler of the report. Enter the commands below.

#1 Ranking: Read how InetSoft was rated #1 for user adoption in G2's user survey-based index Read More

3. Bind the chart to the 'All Sales'

query: Graph1.query = "All Sales"; 

4. Specify query fields to bind to the X-axis ('Company') and Y-axis ('Total'):

 Graph1.bindingInfo.xFields = [["Company",Chart.STRING]];
 Graph1.bindingInfo.yFields = [["Total",Chart.NUMBER]]; 

5. Set the aggregation/summarization method:

Graph1.bindingInfo.setFormula("Total",Chart.MAX_FORMULA) 

6. Set the desired grouping options (e.g., top-N filtering):

Graph1.bindingInfo.setTopN("Company",5)
Graph1.bindingInfo.setTopNReverse("Company",false)
Graph1.bindingInfo.setTopNSummaryCol("Company",
   "Max(Total)");

7. Specify the query fields to bind to a “VisualFrame,” (i.e., for visual coding as subseries):

Graph1.bindingInfo.setColorField("Employee",Chart.STRING); 

8. Close the Editor, an preview the report. The complete script is shown below:

Graph1.query = "All Sales";
Graph1.bindingInfo.xFields = [["Company",Chart.STRING]];
Graph1.bindingInfo.yFields = [["Total",Chart.NUMBER]];
Graph1.bindingInfo.setFormula("Total",Chart.MAX_FORMULA)
Graph1.bindingInfo.setTopN("Company",5)
Graph1.bindingInfo.setTopNReverse("Company",false)
Graph1.bindingInfo.setTopNSummaryCol("Company",
   "Max(Total)");
Graph1.bindingInfo.setColorField("Employee",Chart.STRING);

More Articles About Charting

Evaluate InetSoft's Weekly Dashboard Reporting Software - Are you looking for good weekly dashboard reporting software? InetSoft's pioneering dashboard reporting application produces great-looking web-based dashboards with an easy-to-use drag-and-drop designer. Maximize self-service for all types of users. No dedicated BI developer required. View a demo and try interactive examples...

Data Visualization Shows Climate Zones - Creating a data visualization to show climate zones in the United States can vary in complexity depending on the level of detail and interactivity you desire. Here's a breakdown of the steps and considerations for creating such a visualization: Data Collection: Obtain data on climate zones in the United States. This data may include temperature ranges, precipitation levels, and other relevant climatic factors. Sources like the U.S. Department of Agriculture (USDA) or the National Oceanic and Atmospheric Administration (NOAA) provide climate zone maps...

Measuring Organizational Vision - Number three has to do with being able to clarify and measure organizational vision. So what happens is all these stupid deliberate words go up on the board. The next step is to take all these deliberate words and just bring them together into some awkward sentence. So after six or eight hours of this nonsense, he ends up with some garbled sentence that says our vision is to be a world class leading edge customer focused producer with value added products and services using engaged employees in a lean six-sigma fashion. Everybody says amen, that looks good to me. Afterwards, everyone's mentality is I don't know what the hell it says but it includes my word in it so I like it...

Types of Information Reporting Systems - Management Information Systems (MIS) is often used to describe the systems and technologies that are used for managing an organization, its operations, and its data. Management information systems is a broad term that encompasses many different types of software and hardware. Some of the most common applications are enterprise resource planning (ERP) systems, customer relationship management (CRM) software, supply chain management (SCM) software, enterprise asset management (EAM) tools and business intelligence (BI) tools...

What Is a Business Intelligence Solution? - A BI Solution is a tool that enables employees at all levels of an organization to rapidly access and analyze data to provide insights targeted to the needs of the moment. An effective BI solution provides a high level of self-service so that all members of the organization, from engineers to managers to analysts, can explore data that is meaningful and relevant to their own role without the need for dedicated support staff. Today's concerns are rarely the same as yesterday's. A BI Solution must therefore allow data users to quickly reformulate questions, reorganize data, and produce new visual data presentations on a flexible basis to meet business demands as they continuously evolve...

Previous: Report Scripting - Creating Charts