Jump to content
Software FX Community



Recommended Posts

 I am experimenting with the demo of ChartFX for Java Server.  I've seen a couple of blurbs about annotations and wanted to see its capabilities. Unfortunately, I cannot find the extension.  Where can I find it?  Thanks!

 - Aaron

 p.s. I was mostly interested in the annotations the  user can put on the chart and wanted to be able to save them (if possible).

Link to comment
Share on other sites

Annotation should be available within the chartfx.annotation.jar

You can find this jar a the Web-INF/Lib folder at your samples.

For code snippets, please refer to this links:



You can also check the samples that came with the Chart FX.


If you need further assistance, please let me know.

Link to comment
Share on other sites

 I found it.  It actually resides in com.softwarefx.chartfx.server.annotation. 


The code  snippet in the programmer's guide shows the following (and many more lines of code after it):


Annotation.Annotations annots;
annots = new Annotation.Annotations();
I changed the upper cases to lower cases as follows:
annotation.Annotations annots;
annots = new annotation.Annotations(); 


Link to comment
Share on other sites

 Ok, On Chart FX 7, annotations comes as part of the com.softwarefx.chartfx.server namespace included in the ChartFX70.Server.jar file.

In the Chart FX 7 samples you can find more samples like this one.

 Please look at this code sample:

<%@page import="com.softwarefx.chartfx.server.*"%><%--   Document : polygon   Created on : Mar 19, 2008, 12:00:20 PM   Author : Administrator--%><%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>   <head>   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">   <title>Annotation: Polygon</title>   </head>   <body>   <%   ChartServer chart1 = new ChartServer(application,request,response);chart1.importChart(FileFormat.XML, application.getRealPath("/") + "/data/samples.cfx");com.softwarefx.chartfx.server.annotation.Annotations annot = new com.softwarefx.chartfx.server.annotation.Annotations();   chart1.getExtensions().add(annot);     com.softwarefx.chartfx.server.annotation.AnnotationPolygon poly = new com.softwarefx.chartfx.server.annotation.AnnotationPolygon();     annot.getList().add(poly);   java.awt.Point[] p = new java.awt.Point[4];   p[0] = new java.awt.Point(250,50);   p[1] = new java.awt.Point(320,150);   p[2] = new java.awt.Point(300,250);   p[3] = new java.awt.Point(200,100);   poly.setColor(java.awt.Color.red);poly.setVertices(p);poly.setClosed(true);   chart1.setWidth(600);   chart1.setHeight(400);   chart1.renderControl();     %>   </body></html> 

Link to comment
Share on other sites

 Are there any examples allowing the user to modify or edit (or even show the toolbar)?  I can't seem to get it to work (the below code doesn't allow the user to show the toolbar or modify the text annotation):

  annotation.Annotations annots;    annots = new annotation.Annotations();    chart1.getExtensions().add(annots);    annotation.AnnotationText text;    text = new annotation.AnnotationText();    text.setText("This is an Annotation Text2");    text.setTop(120);    text.setLeft(100);    text.setAllowModify(true);    annots.getList().add(((annotation.AnnotationObject)text));    annots.setEnableUI(true); annots.getToolBar();

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...