-> Label Step Interval
in Chart Designer. You can also click on the Format value elements icon in the toolbar.
Are there any limitations on the length and type of characters in labels?
There is no practical limitation on the length of string in a label. However, the use of single
quote in a string will cause plotting errors on data refresh.
The x/y grid in the chart is too dense.
You can set the grid step size in the axis label dialog box (under Edit-Axis Label...) in Chart
designer or use the GRID_STEPSIZE property in API.
How can I change the Line Chart so that it will not draw at the origin?
You can set the X_SHIFT property in the API to displace the whole line chart away from the origin.
Why does some of the text I add shift after the chart export?
EspressChart remembers the relative x, y ratio of the added text position relative to the drawing
area. So when the size of the drawing area changes, the text may shift. To avoid this,
try to design and export the chart using the same size.
How do I remove the log file for EspressEspressManager?
You can edit the file server.log or espresschart/services/chserver.ini (for NT services) to
remove the -log option.
Why do the constructors for QbChart take Applet or Frame parameters? What info does it take
from those params?
For Applet parameter, it is used to get the address of EspressEspressManager (i.e. get the remote
server.cfg file) in the browsers environment and also export the chart using applet.createImage().
For Frame parameter, it is used in standalone application for export the chart using
frame.createImage(). In this case the file server.cfg is assumed to locate in current directory.
At least one constructor is needed for export since createImage() needs a component object.
If you are not using EspressManager and not intend to export image you can pass a null pointer
to the constructor as follows:
Frame frame = null;
QbChart(frame, ....);
or
Applet applet = null;
QbChart(applet, ....);
When we tried using EspressChart on a simple telnet session (rather than XTerm) it gives us an
error (some X11 windows error) ?
Please download the latest version of EspressChart for Solaris and try program
http://www.quadbase.com/espresschart/help/examples/example9.html
We telnetted vt102 to Solaris using our PC and it works fine.
Please note that the most important things are :
(1) Use the addNotify() call if you do not intend to display the chart before constructing
a Qbchart. Otherwise null pointer exception will occur.
(2) The Solaris system must have a display monitor and graphics card in it or have permission
to X server. JDK can't draw anything if your Unix machine doesn't have a display card or
Xvfb (from XFree86 server) environment. Note that the color of GIF/JPEG output is limited by
the color resolution of the graphics adapter of it.
(3) You may need to type the command
xhost +
after login as a supervisor in the solaris machine locally (don't telnet from other machine and
type xterm +). Otherwise you may encounter Xlib connection refuse error.
(4) You don't need to set display to your local machine (i.e. setenv DISPLAY machineName:0.0) even
though your telnet program can emulate xterm. But you need to set the display variable of the server in
order to pass the font and other graphic information to the X server. To test whether the X server is
running, you may use the command ps -ef and see whether one of the process is /usr/openwin/bin/X
If not you may start X windows manually by typing startx. After export with API, if the solaris hung,
you may need to add the line System.exit(1); in the java code to stop the invisible frame that was
created before export.
When running EspressChart remotely from a Unix server (e.g. Solaris) without a display card, it
gives us a "quadbase.chart.C-string class not found error" or "X11 not found error" when connecting
to oracle database?
You got this error when you tried to run EspressChart remotely without a display card on the
server or without setting permission to X server. You can either run from the server using X window
from another machine, or install Xvfb (from Xfree86) on your server before running EspressChart.
You may also connect remotely with a X emulator connected to the server and X windows running on
the local machine. Below is an example of one customer's setup: DISPLAY environment variable which
has to be set does not need to be pointing to the server hosting espresschart. EspressChart can be
on machine A, which does not have X. Machine B has X. Just point DISPLAY to machine B. It works fine
for us since machine A is the web+apps server (for security reason X is not installed). Machine B is
oracle, and it need X for some oracle database apps. Works fine (may be a bit slow since it has to hops
from 1 to another). Below is one successful oracle connecting code, which runs with a classpath to
classes12.zip
// Import all necessary classes
import quadbase.ChartAPI.*;
import quadbase.util.*;
import java.awt.*;
import java.sql.*;
import oracle.jdbc.driver.*;
import java.applet.*;
// Set up Frame
public class c2 extends Frame {
public QbChart chart;
// Start Frame
public c2() {
start();
}
// Create Empty Chart and set up initial data and wipe out empty chart data
public void start() {
QbChart.setChartServerUsed(false);
setLayout(new BorderLayout());
// primary axis value column 3
// secondary axis value column 2
// ColInfo(series, category, sumby, primary_value, secondary_value)
DBInfo dbinfo = new DBInfo("jdbc:oracle:thin:@serv1e:1521:owr98eh",
"oracle.jdbc.driver.OracleDriver", "elkdss", // username "welcome", // password
"select to_char(PROD_INJ_DATE), OP/days_prod,GP/days_prod, WP/days_prod from eh_dss.ZONE_VOLUMES
p, eh_dss.ZONE_LOCATION l where p.api = l.api and days_prod>0.0 and l.zonename like '326-26R%'");
// SQL query
ColInfo colInfo = new ColInfo(1, 0, -1, 2);
QbChart chart = new QbChart((Applet)null, QbChart.VIEW2D, QbChart.LINE,dbinfo, true, colInfo,null);
// set background color to white
ICanvas hCanvas = chart.gethCanvas();
hCanvas.setBackgroundColor(Color.white);
Color[] colors={Color.black, Color.red, Color.orange, Color.blue, Color.green, Color.pink,
Color.cyan, Color.magenta, Color.gray, Color.pink, Color.lightGray, Color.black, Color.yellow,
Color.red, Color.green};
// Set XAxis
IAxis hXAxis = chart.gethXAxis();
hXAxis.setLabelOutsidePlotArea(true);
hXAxis.setVisible(true);
ILabel hXAxisLabel=hXAxis.gethLabel(); // Getting handle to x Axis labels
hXAxisLabel.setColor(Color.black); // Setting color to white
hXAxisLabel.setAngle(90); // Making them horizontal
// Set YAxis
IAxis hYAxis = chart.gethYAxis();
ILabel hYAxisLabel=hYAxis.gethLabel();
hYAxisLabel.setColor(Color.black);
// Set all axes
hXAxis.setArrowhead(false);
hXAxis.setThickness(5);
IDataPointSet dataPoints=chart.gethDataPoints();
dataPoints.setLabelStep(1, 2); // Show every 3rd label
dataPoints.setGridStep(1, 2); // Show every 3rd grid line and by entension ticker
dataPoints.setColors(colors);
//Hide legend
ILegend legend = chart.gethLegend();
legend.setVisible(true);
//Best-fit primary axis
IAxis iaxis = chart.gethYAxis();
iaxis.setOriginAutomatic(true);
add("Center", chart);
}
//Start
public static void main(String[] args) {
c2 t = new c2();
t.resize(500,550);
t.setVisible(true);
}
}
When we execute servlet in Solaris with JDK1,2 using API in EspressChart, it gives us a "C-string
not found error"?
The error is received because the X server cannot be connected to. This is a very deceptive
exception. What you have to do is to start the X server under root and make sure it is accessible
by EspressChart or the program running EspressChart API.
After X11R6 (Xvfb) started, EspressChart still gives "quadbase/chart/C-string not found error"
After I started X, or Xvfb, I still have the problem and the culprit was the environment variable.
I did not set my DISPLAY environment variable, since I always use telnet. You may want to include the
hint on DISPLAY environment variable, since when you mention EspressChart could not find X, it is not
very clear to non-admin people to trouble shoot. I got the hint from our admin support about DISPLAY
property. DISPLAY can be set to simply ":1.0" or "127.0.0.1:1.0" or "A.B.C.D:1.0" where "A.B.C.D" is
the machine's IP address. In Apache/Jserver, one line should be added to the jser.properties file when
Apache and Jserver are started the same time. wrapper.env=DISPLAY=localhost:0.0.
For IBM AIX machine, login command window as Administrator export DISPLAY=IP_address:0.0 depending
on which screen the X-Server is running on. Start Web Sphere in the same window.
On solaris and Iplanet Enterprise Web server, use either one of the following command lines after
login as Administrator
setenv DISPLAY=IP_address:0.0
export DISPLAY=IP_address:0.0
You may want to add the above line to the start-up script of Iplanet Web server.
Are there alternatives to X-windows display and Xvfb?
One option is the PJA Toolkit. PJA Toolkit is a pure Java implementation of the GraphicsEnvironment
methods in Java, and does not use native code. Therefore, can also be used in place of an X-window,
or XVFB. Click
here to
download documentation & sample file for the PJA Toolkit.
Commands to run X server in background for Sun / Unix
Even though the solaris are running from a remote site, the production people refused to go headless
as they wanted to be able to use the console in the event they could not reboot remotely. They also
refused for us to send the DISPLAY to another server running the Xserver sighting security concerns.
The workaround was the following:
> First, turned off the production CDE (this is the production's console login prompt):
>/usr/dt/bin/dtconfig -d
>Second, created a start-up script for when the system reboots to
>start up the local Xserver, create an xterm window at the local console and
>then lock the local console:
>nohup /usr/openwin/bin/Xsun :0 &
>nohup /usr/openwin/bin/xterm -C -rw -geometry 110x40 -ls -fn 10x20 -bg black -fg yellow -sb -sl
1000 &
>nohup /usr/openwin/bin/xlock &
> Third, started up Websphere with the following parameters added to
>it's start-up script
>DISPLAY=:0
>export DISPLAY
> Fourth, reboot the server.
This allows EspressChart to be able to use the Xserver and graphics card at all times while also
allowing the system admin's the ability to still use their local console whenever they need to without
having to affect the Xserver.
The color of the output reduced to 256 when I export in Chart Designer even though my graphics
display supports true color.
This is a bug that happens in Netscape 3.x only. In IE4.x and Netscape 4.x there is no such
problem. Note that the color of the output depends on the no. of colors in your display card.
The scroll bar is very annoying! How can I get rid of it?
The scroll bars can be added or removed from the Format / canvas pulldown menu of EspressChart
2.1 or higher.
I don't like the current chart size. Can I make it bigger?
One may either use Format / canvas in Chart Designer or right drag the mouse on the chart to
increase its size.
Why does my browser say that it cannot find the quadbase.chartViewer.Viewer.class even though my
classpath is set to the root EspressChart directory when I create a HTML file to view a .cht file
through the Chart Viewer?
The EspressChart classpath is probably set as a system variable and there may be a user classpath
present without the EspressChart classpath. Add the EspressChart classpath to the user classpath
as well and run the HTML file again.
Does EspressChart support stored procedures?
Yes, you can specify a stored procedure in the query. For the multiple result sets/response reply,
EspressChart will use the first non-empty result set to plot the chart. The mechanism is same for the
code bridgeTest/TestDB.java in your EspressChart installation directory.
Does EspressChart support parameterized queries?
You need to format your query to be non parameterized before passing it to EspressChart. However
you can set the query at any time in the API using the properties DATASOURCE. All attributes
of chart will be preserved when the query is changed. Besides you can make use of Chart Viewer query
input capability to dynamically generate html page for query of different parameters as follows:
<applet code = "quadbase.chartViewer.Viewer.class" width=640 height=480
<PARAM name="sourceDB" value="jdbc:odbc:DataSource, sun.jdbc.odbc.JdbcOdbcDriver, userername,
password, formatted query">
<PARAM name="dataMap" value="0 1 -1 3">
<PARAM name="chartType" value="3D Column">
<PARAM name="filename" value="mytemplate.tpl">
</applet>
Does EspressChart support object-oriented databases as well as SQL queries?
No, but Chart API allows you to fetch the data from database your own method and pass the data as
an argument in the constructor of chart. (see QbChart).
Does EspressChart support real-time data fetching from database when Chart Viewer is loaded?
Yes, you can simply designed the chart by Chart Designer and save the chart in .tpl format,
say mychart.tpl. The database URL, driver username, password are encrypted and saved together
with the other chart attributes in mychart.tpl (except the database data). Then add the
following code to your html page:
<applet code = "quadbase.chartViewer.Viewer.class" width=640 height=480>
<PARAM name="filename" value="mychart.tpl">
</applet>
Now every time the applet loads, it will contact the EspressManager to fetch the updated data from
database and plot the chart.
Can I schedule Chart Viewer to refresh itself from a database after a specified time interval?
Yes, you can either set the scheduling interval through the Chart Designer and save it in .tpl
format as above, or add the parameter
<PARAM name="RefreshInterval" value="60">
in Chart Viewer. In the above example the chart will refresh every minute. Note that if the refresh
time interval is set in both Chart Designer and Chart Viewer, the latter one is used. In particular if
the refresh interval in chart Viewer parameter is set to a negative value then scheduling is disabled
even if it has been set in Chart Designer.
Can I get data from my own datasource and push the data to chart viewer to update it continuously?
Yes, chart Viewer supports parameter server which allow users to push the data to the viewer. See
the parameter server section in chart viewer.
Do I need to know programming or complicated EspressChart applet parameters in order to publish my
own chart in the web?
No, all you need to do is go to the Chart Designer login page using any Java enable browser, follow
the simple wizard steps to create and design your own chart. Then save the chart in either .cht or .tpl
format and publish your chart on the web as follows:
<applet code = "quadbase.chartViewer.Viewer.class" width=640 height=480>
<PARAM name="filename" value="mychart.cht">
</applet
How can I specify to use EspressManager in different machine instead of the one in Web server?
You can specify the connection details in either the API code to connect to a different EspressManager by using the setServerAddress and setServerPort methods in QbChart.
Can I save/load/export the chart in client machine instead of server machine?
You can eliminate the need for connecting to EspressManager by calling the static method setEspressManagedUsed(false), before creating the QbChart constructor. Now all save/load/export will have on the machine running the code, rather than the server machine.
Does EspressChart support JavaBeans?
EspressChart 1.4 and higher support JavaBeans as component in an IDE environment.
Can I export the chart in other formats?
Yes, you can export the chart in GIF, JPG, PNG, BMP, WMF, WRL, FLASH, PDF, TPL and CHT format using either Chart
Designer or the Chart API.
Does EspressChart support image maps?
Yes, you can define hyperlinks with different url and target in Chart Designer (see manual) or API
(see example14.html). When chart is export in the GIF/JPEG and BMP formats, two files with extension
.map (for client side image mapping) and _s.map (for server side image mapping) will be exported in
the same directory as the image when the hyperlink is defined. You can then import this .map file in
your html page easily. See document source in maparea3d.html.
Is it necessary to install the classpath of EspressChart in the environment variable CLASSPATH in
web server machine?
No, the installation program add the classpath for programmer to use the API. You can safely remove
the classpath from the environment variable CLASSPATH.
Can we pass data directly to the Chart Viewer in the html page?
Yes, here is an example:
<applet code = "quadbase.chartViewer.Viewer.class" width=640 height=480>
<PARAM name="sourceData" value="int string int | value name, vol | 10, 'John', 20 | 3, 'Mary',
30 | 8, 'Kevin' 3 | 9, 'James', 22">
<PARAM name="dataMap" value="-1 1 -1 2">
<PARAM name="chartType" value="3D Bar"<
<PARAM name="filename" value="mytemplate.tpl">
</applet>
The last parameter filename is optional. It specifies a template to apply to the chart. If
it is omitted, the default attributes are used.
How can I change the default port number of EspressChart?
It is not a good idea to change the default port no since EspressChart will use 22071 as the
default one when it fails to load server.cfg. However you can change it by editing the \
section [portno] in espresschart/userdb/config.txt. After that, restart the EspressManager (so that a
new config file server.cfg is created), the Web server (since it may cache the old version of
config file), and the browser (since it will cache the config file locally).
Can EspressChart support different date/time formats?
Yes, EspressChart supports different formatting option of date/time, timestamp, boolean and numeric
value. See here for details.
Where can I found documentation on NumericFormat, DateTimeFormat, LogicalFormat ?
They are located in the apidocs under EspressChart/help/apidocs/index.html .
Why is the Trend Line missing in some charts?
Currently, only 2-d charts of types Column, Stack Column, Area, Stack Area, Scatter, Line, HLCO and
Hi-Low support Trend Line.
Where can I find more API examples?
The API examples are contained in EspressChart/help/examples/index.html .
The jar files are too big. Can they be smaller?
One may select EspressAPI_2D.jar, or EspressAPI_3D.jar to replace EspressAPI.jar in your
application if only 2D or 3D charts are needed.
How can I put the chart at the center of the canvas?
You may set the width and the height in API to (1-W)/2 and (1-H)/2 where W and H are the width and height
of the chart. You can obtain W and H by using the getRelativeWidth and getRelativeHeight methods from the chart's canvas.
Where is the API information on data transpose?
The API is called isSpreadSheetFormat (boolean) and the documentation is located in
help\apidocs\quadbase\ChartAPI\QbChart.html
Parameterized query not working with error message "Service does not support parameterized query"
EspressManager has to start with EspressManager.bat for the Parameterized query to work. Please see
the known bug list.
When using the API I got message "Failed to read server.cfg, use default host and port no 22071"
The chart API is trying to contact EspressManager but failed to locate the server.cfg file. You can
either safely ignore this message (if the default is OK) or copy the server.cfg file from the
espresschart installation directory (after EspressManager is started) to your program directory (or
codebase directory of your program).
Can the Chart API do without EspressManager?
For operations that do not require contacting EspressManager, you may use the QbChart class static
method: setChartServerUsed(false) which will replace the EspressManager with the current directory of
espresschart.
How do I set the decimal point and remove the thousand seperator?
Create a NumericFormat object and set its properties. And then get a handle to
IDataPointSet and use setLabelFormat to set the properties for the column.
For example, if the format for Column 2 has to be changed to remove the thousand seperator and to
have no decimal, then use the following code:
NumericFormat format = new NumericFormat();
format.decimal = 0;
format.thousandSep = 'N';
IDataPointSet dataPoints = chart.gethDataPoints(); // where chart is the
QbChart object
dataPoints.setLabelFormat (2, format);
How do I set the chart so that it cannot be dragged or resized?
Get a handle to IMouseEventSet and use the methods setDragEnabled and setResizeEnabled.
IMouseEventSet mouseEvents = chart.gethMouseEvents(); // where chart is the
QbChart object
mouseEvents.setDragEnabled(false);
mouseEvents.setResizeEnabled(false);
How do I change the scale of an axis?
Get a handle to IAxis and use setScaleAutomatic to disabel automatic scaling and then the methods
setMinScale, setMaxScale and setScaleStep to provide the new scale.
For example, if the y-axis scale has to be changed so that it starts at -10 and ends at 100 in
increments of 10, then use the following code:
IAxis yAxis = chart.gethAxis(); // where chart is the
QbChart object
yAxis.setScaleAutomatic(false);
yAxis.setMinScale(new Integer(-10));
yAxis.setMaxScale(new Integer(100));
yAxis.setScaleStep(new Integer(10));
How do I swap the primary and secondary axis and how do I specify the chart type for the secondary
axis?
Get a handle to ISecondaryAxis and use setSwapAxis to swap the primary and secondary axis.
To specify the chart type for the secondary axis, use the method setCombinationType
ISecondaryChart secondaryChart = chart.gethSecondaryChart();
secondaryChart.setCombinationType(QbChart.COMBO_COL); // Sets the secondary chart to be a Column
Chart
secondaryChart.setSwapAxis(true); // Swaps the primary and secondary axis
How do I change the font settings for the labels, titles, etc. ?
Get a handle to the interface (for example, gethMainTitle() for the main title,
IAxis.gethLabel() for the data top labels, IAxis.gethTitle() for the axis title etc.). Then if
the methods of IText are inherited, you can call the methods setAngle, setColor and setFont OR you can
get a handle to the IText interface and call the methods there.
For example, if the data top labels for the x axis are shown in 90 degrees (vertically, bottom to
top), color Red and font Times New Roman, size 12 and Bold, then use the following code:
IAxis xAxis = chart.gethXAxis();
ILabel xLabel = xAxis.gethLabel();
xLabel.setAngle(90);
xLabel.setColor(Color.red);
xLabel.setFont(new Font("Times New Roman", Font.BOLD, 12));
How do I specify the column mappings for the chart?
Use ColInfo to set the column mappings for the chart.
For example, if you want to create a StackColumn-Stack Area combo chart and you wanted to use
- Column 3 as your category
- Column 1 as your series
- Column 2 as your sum-by
- Column 5 as your value; and
- Column 4 as your subvalue
then use the following code:
ColInfo colInfo = new ColInfo(1, 3, 2, 5, 4) // ColInfo (series, category,
sumby, value, subvalue)
OR
ColInfo colInfo = new ColInfo();
colInfo.category = 3;
colInfo.series = 1;
colInfo.sumby = 2;
colInfo.value=5;
colInfo.subvalue=4;
How do I explicitly set the color for the series or categories (if no series are specified)?
Get a handle to IDataPointSet and create an color array object and then use setColors to assign
the colors. Please note that if the number of categories/series do not match the number of
elements in the color array object, the colors will not be assigned.
For example, if there were four elements in the series, then use the following code:
IDataPointSet dataPoints = chart.gethDataPoints();
Color dataColor[] = {Color.white, Color.yellow, Color.red, Color.blue};
dataPoints.setColors(dataColor);
How do I change the Origin of the chart i.e., where the x-axis and y-axis intersect?
Get a handle to the axis and use setOffset to change where the axis intersect each other.
For example, if you want the axis to intersect at (4, 25), then use the following code:
IAxis xAxis = chart.gethXAxis();
xAxis.setOffset(new Integer (4));
IAxis yAxis = chart.gethYAxis();
yAxis.setOffset(new Integer (25));
How do I set it up so that the navigation panel does not show up when a 3d chart is shown and
disable the toggling?
Get a handle to I3DControlPanel and use the method setVisible to not show the nagivation panel
and setToggleEnabled to disable the toggling.
I3DControlPanel navPanel = chart.geth3DControlPanel();
navPanel.setVisible(false);
navPanel.setToggleEnabled(false);
How do I set it up so that the chart is always displayed without any need for scroll bars?
Use the following code to set up the chart so that if the applet/frame size is increased or
decreased, the chart is always shown without any need for a scrollbar.
QbChart.setScrollBarOption(ScrollPane.SCROLLBARS_NEVER);
Dimension appletSize = this.getSize();
Dimension chartSize = new Dimension();
// Setting the size of the chart to that of the applet
chart.setSize(appletSize);
// Preventing resizing or dragging so chart remains centered
IMouseEventSet mouseEvents=chart.gethMouseEvents();
mouseEvents.setDragEnabled(false);
mouseEvents.setResizeEnabled(false);
How do I write an application to export a chart in GIF/JPEG form without using EspressManager?
You can obtain it from the manual which can be viewed here.
How do I use a servlet to export a chart in GIF/JPEG form to browsers?
You can obtain it from the manual which can be viewed here.
How do I read null data in EspressAPI to replace 0 value for the purpose of eliminating colored
line in stackcolumn chart?
Reading from a data file, the zero data is "0" or 0 and the null data "" with Chart Designer.
However, the null data is null instead of "" with Chart API. This is because null is a keyword in
Java but not in txt file.