rubyrubin Posted November 18, 2009 Report Share Posted November 18, 2009 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). Quote Link to comment Share on other sites More sharing options...
juanZ Posted November 18, 2009 Report Share Posted November 18, 2009 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: http://support.softwarefx.com/OnlineDoc/CfxJava65// http://support.softwarefx.com/OnlineDoc/CfxJava65//guide/includingannotationextension.htm You can also check the samples that came with the Chart FX. If you need further assistance, please let me know. Quote Link to comment Share on other sites More sharing options...
rubyrubin Posted November 18, 2009 Author Report Share Posted November 18, 2009 That .jar doesn't exist there. I am actually using chartfx7 (does that affect where it lives?) (I didn't post to the ChartFX 7 group, since it didn't have an "extenstions" folder to post to. Quote Link to comment Share on other sites More sharing options...
rubyrubin Posted November 18, 2009 Author Report Share Posted November 18, 2009 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(); Quote Link to comment Share on other sites More sharing options...
rubyrubin Posted November 18, 2009 Author Report Share Posted November 18, 2009 Also, later on in the same code snippet, it calls "arrow.Attach(2,0,50.0)", however there is no method "Attach". I changed it to the lower case "attach". I wonder how this sample ever ran? Quote Link to comment Share on other sites More sharing options...
juanZ Posted November 18, 2009 Report Share Posted November 18, 2009 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> Quote Link to comment Share on other sites More sharing options...
rubyrubin Posted November 18, 2009 Author Report Share Posted November 18, 2009 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(); Quote Link to comment Share on other sites More sharing options...
juanZ Posted November 20, 2009 Report Share Posted November 20, 2009 Hi, You should try to use annot.getToolBar().setVisible(true); instead of annots.getToolBar(); only. However Im checking right now this because I think there is an issue related. I will be osting more information soon. Sorry for the delay. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.