Integrating your development into an application
You can integrate a complete chart into an application through the project file or you can integrate only the style sheet to have the styling developed in the Designer applied to real data in an application.
To integrate a chart into a Java application:
1. Make sure all the project files (the .icpr and the .css files) are accessible from the application.
2. In the source code of your application, add the following lines of code once the chart instance has been created:
IlvChart chart = ...;
try {
URL project = ...;
// Apply the project file to the chart chart.setProject(project);
} catch (IOException e) {
...;
} catch (IlvStylingException se) {
...;
}
The chart is thus configured according to the settings of the project file.
The code for creating the chart instance and loading the project file is shown in:
NOTE A project file includes both data and style sheet. When a project is set, it replaces any data source and style sheets that may have been previously set on the chart.
For details on how to integrate the chart into a thin-client application, see
The JViews Charts JSF component set in
Building Web Applications.
If you have a custom data model and your application is already defined, you can use the Designer for styling only on a sample of dummy data or on an XML dump of your data.
Then you can integrate the style sheet from the Designer into your application. You can apply the styling defined in the style sheet to the real data used in the application. The Designer makes it much easier to write the style sheet.
To style the chart component of your Java application or DHTML thin-client application using an existing project style:
1. Make sure that the project styling file ( .css file) is accessible from the application.
2. In the application, after creating the chart and loading the data model, use the following code:
try {
chart.setStyleSheets(new String[]{"yourStylingFile.css"});
} catch (IlvStylingException x) {
System.err.println("Cannot load style sheets: " + x.getMessage());
}
For more information on how to load style sheets in a Java application or DHTML thin-client application, see
Styling in
Developing with the SDK.
You can also look at the Charts CSS sample that can be found in:
<installdir>/jviews-charts/samples/css
For more information on how to integrate a style sheet into a DHTML-based JSF thin-client application, see
Styling chart data with CSS in
Building Web Applications.
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.