JFreeChart Line Chart points

Hi coders, I have implemented a line chart from the JFreeChart and have got it working nearly how i want. The only problem i have now is that there are 2series using a line and 1 series using points, i was wondering if anyone knew how i could change the colour of the individual series and also the type of point or line they may have.
public ChartPanel allAlgorithm()
               final XYDataset alldataset = createDatasetLine();
             final JFreeChart lineGraph1 = createChart(alldataset);
             panel6 = new ChartPanel(lineGraph1);
               return panel6;
          * Creates a sample dataset.
          * @return a sample dataset.
         private XYDataset createDatasetLine() {
             XYSeries series0 = new XYSeries("Straight Comaprison");
              XYSeries series1 = new XYSeries("Minimum Edit Distance");
             XYSeries series2 = new XYSeries("Longest Common Sequence");
             int users = 1;
             resultsArray = results.getResultSet();
               //assign the results data to the ArrayList
               int totalFile = resultsArray.length;;
               //a for loop to returnt he usernames from the ArrayList and also to
               //return the data from the 2D Array
              for (int i = 0; i < resultsArray.length; i++){
                   String x = StraComp[0];
               String y = MinEdit[i][0];
               String z = Lcs[i][0];
                         //System.out.println("Total File Size"+totalFile);
                         if(x.equals("XXXX")){
                              //do nothing
                         }else{
                              //changes the value to a double
                              double dbX = Double.parseDouble(x);
                              double percetX = (totalFile/dbX) * 100;
                              if(percetX >= 100){
                                   percetX = 100;
                              series0.add(percetX, users);
                         if(y.equals("XXXX")){
                              //do nothing
                         }else{
                              //changes the value to a double
                              double dbY = Double.parseDouble(y);
                              double percetY = (totalFile/dbY) * 100;
                              if(percetY >= 100){
                              percetY = 100;
                              series1.add(percetY, users);
                         if(z.equals("XXXX")){
                              //do nothing
                         }else{
                              //changes the value to a double
                              double dbZ = Double.parseDouble(z);      
                              double percetZ = (totalFile/dbZ) * 100;
                              if(percetZ >= 100){
                                   percetZ = 100;
                              series2.add(percetZ, users);
                         users++;
     XYSeriesCollection alldataset = new XYSeriesCollection();
     alldataset.addSeries(series0);
     alldataset.addSeries(series1);
     alldataset.addSeries(series2);
     return alldataset;
     * Creates a chart.
     * @param dataset the data for the chart.
     * @return a chart.
     private JFreeChart createChart(final XYDataset alldataset) {
     // create the chart...
     final JFreeChart chart = ChartFactory.createXYLineChart(
     "All Algorithms Together",     // chart title
     "Number of Lines", // x axis label
     "Users", // y axis label
     alldataset,      // data
     PlotOrientation.VERTICAL,
     true, // include legend
     true, // tooltips
     false // urls
     chart.setBackgroundPaint(Color.white);
     // get a reference to the plot for further customisation...
     final XYPlot plot = chart.getXYPlot();
     plot.setBackgroundPaint(Color.lightGray);
     plot.setDomainGridlinePaint(Color.white);
     plot.setRangeGridlinePaint(Color.white);
     final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
     renderer.setSeriesLinesVisible(0, false);
     renderer.setSeriesShapesVisible(1, false);
     plot.setRenderer(renderer);
     // change the auto tick unit selection to integer units only...
     final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
     rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
     return chart;

I would try posting to the JFreeChart forum. They would probably have the best knowledge and maybe someone there may have done it before.
http://www.jfree.org/phpBB2/index.php
Darren

Similar Messages

  • Jfreechart line chart mouse click problem

    i need to implement a line chart where users can click on an area of the chart and highlight it, i have serveral questions regarding how to do this:
    i added a mouselistener to the chartpanel, i can get the points with e.getTrigger().getPoint(), but I need the points associated with the graph point, is that possible?
    i also need to highlight an area of the line chart, I have no idea where to begin, will i be able to change the background of a specific range of points?
    help would be appreciated!!

    Hi,
    I have not tested your code, but check these links. This might help.
    http://blogs.adobe.com/flexdoc/2009/07/date_range_selection_for_flex.html
    http://www.stretchmedia.ca/code_examples/chart_range_selection/main.html

  • JFreeChart - line chart

    Hi
    I need to generate a refreshed line chart that will have only Y cordinates (the X axis is just the samples number....) and there are two different lines in my chart.
    I am searching for a free toturial or exaples ect....
    Please if you have any information please send me the link the best i got is this:
    http://www.javaworld.com/javaworld/jw-12-2002/jw-1227-opensourceprofile_p.html
    thanks
    Liat

    I would try posting to the JFreeChart forum. They would probably have the best knowledge and maybe someone there may have done it before.
    http://www.jfree.org/phpBB2/index.php
    Darren

  • How can I connect dots across missing data points in a line chart?

    Hi all!
    I have a table in Numbers that I update every few days with a new value for the current date (in this case body metrics like weight, etc.), which looks something like this:
    Column 1              Column 2      Column 3
    Aug 16, 2011         87.1             15.4
    Aug 17, 2011         86.6
    Aug 18, 2011         86.1
    Aug 19, 2011              
    Aug 20, 2011         85.7             14.6
    Aug 21, 2011         85.3
    Every once in a while there will be a missing value for a given date (because I didn't take a reading on that day). When I plot each column against the date on a line chart, there is a gap where there are missing data points. The line does not connect "across" missing data points. Is there a way to make the line connect across missing data points?
    Thanks for any help. This thing has been driving me nuts!

    Leave your nuts in peace.
    Don't use line charts but scatter charts.
    These ones are able to do the trick.
    Of course to do that you must study a bit of Numbers User Guide.
    In column D of the Main table, the formula is :
    =IF(ISBLANK($B),99999,ROW())
    In column E of the Main table, the formula is :
    =IF(ISBLANK($C),99999,ROW())
    Now I describe the table charter.
    In column A, the formula is :
    =IFERROR(DAY(OFFSET(Main :: $A$1,SMALL(Main :: $D,ROW())-1,0)),"")
    In column B,the formula is :
    =IFERROR(OFFSET(Main :: $A$1,SMALL(Main :: $D,ROW())-1,1),"")
    In column C, the formula is :
    =IFERROR(DAY(OFFSET(Main :: $A$1,SMALL(Main :: $E,ROW())-1,0)),"")
    In column D, the formula is :
    =IFERROR(OFFSET(Main :: $A$1,SMALL(Main :: $E,ROW())-1,2),"")
    In this table, select the range A1 … D5
    and ask for a Scatter chart.
    You will get what you need.
    I asked that points are joined by curves
    I just edited the parameters of Xaxis and Yaxis to get a cleaner look.
    I repeat one more time that knowing what is written in the User Guides is useful to be able to solve problems with no obvious answer.
    Yvan KOENIG (VALLAURIS, France) samedi 27 août 2011 15:59:20
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Web Application Designer (Line Charts-Data Points)

    Hi
    I have to display the query in WEB as a Line Chart
    The Query is on Cal Day Vs Mean Value
    The user enter the Cal Day (From/To)..the Line chart is supposed to display mean Value on No of Cal Days users choosed.
    In query created variable for Cal Day..but how can i define the Data Points for the chart in the Web designer.
    Bydefault we have to specift no of data points we required..how can i change that to be based on the range user entered
    Than ks

    Hi Krishna,
    When you define a chart, you define a number of series, but when you run the WAD, it takes the number of series it has the query.
    Regards,
    Diego

  • Showing one data point on a line chart - X-axis label placed away from its actual position

    Hi Guys,
         In line chart, i used CircleItemRenderer to show single data point. It shows correctly if it is single data point. But the x-axis label placed away from its actual position. Right now it displayed left most position where the line chart starts. I need to move that label straight of that datapoint where it plotted.  Please see the screen shot attached with this post.
    In screen shot, x-axis label "Jan" displayed in left most position.
         And how can we show the datatip for single datapoint. At present, we can't able to see the datatips also with single datapoint.
         Can any body help me to fix those two issues.

    I figured out a way to customize a single datapoint in a line series.  The solution is at this link:
    http://www.flexdeveloper.eu/forums/flex-charting/customize-a-datapoint-in-a-line-series/

  • Remove one segment of line connecting points in a trendline chart?

    I have a linear trendline plotted where the data points for the first 19 values lie on either side of the trendline. These are joined by a dashed line. I want to keep that line intact.
    The last 9 points lie along the trendline and are indistinguishable from it. That's fine, too.
    I want to remove just the segment of the dashed line running from the last distinguishable point to the first indistinguishable one. Breaking the 28 point dataset into two sets isn't an option since I need all 28 to produce the trendline. The trendline is the reason for the chart.
    Anything I can do to remove that segment of dashed line? Wite Out isn't an option.
    Thanks for any ideas.

    Badunit--
    That is really clever, and it should work. I really appreciate your response.
    You've understood the problem. I have a trendline derived from the cluster of data points with one point for each of 20 years (1991-2010). My requirement is a chart showing both those 1991-2010 points and the trendline (with precision) from 1991 extended to 2020. Since the known values stop at 2010, and since Numbers can't extend the trendline without a workaround, I received help (from you, as a matter of fact) last year on this Forum finding a way to plot the line (essentially by trial and error for the future points). To check my values from last year, I tried out Excel for Mac 2004 and found Excel provided the numerical values through 2020. I plugged them into my Numbers table and life is good.
    The objective in this post was to remove the connector joining the 2010 point to the trend line value point for 2011. The 2011-2020 points don't need to be visible--only the trendline they generate.
    Your solution should result in my generating the trendline using my full set of 1991-2020 points. I suppose the points along it from 2011-2020 could be made invisible while the trendline stroke and color could be "robust."
    A second series, the set of points for 1991-2010, will be visible and connected. If the first series of points is made invisible, there won't be any double vision problems for 1991-2010.
    Much appreciated. I'll give it a try. [ I went into the detail above since someone else may encounter similar problems. FYI, your previous help was on 22 July 09].
    Terry

  • Line Chart Problem, multiple point in X axis

    I need to create a line chart , with many data points between two points in the X-Axis.
    For example,
    for month january my reading is 4,3,5,2,8
    for month feb my reading is 1,5,3,5,2
    I need only two points in X axis, which are january and feb and all the reading should come in gaph.
    I am attaching a picture of the graph i required. Can any one help me how should i fill the arraycollection or XML in order to get the graph.

    Here is a script which will illustrate how to conditionally display the X-axis label on a line chart:
    DROP TABLE tmp_test_data;
    CREATE TABLE tmp_test_data
    (date_stamp DATE,
      value      NUMBER);
    BEGIN
      dbms_random.seed(1234535678);
      FOR i IN 1 .. 233 LOOP
        -- get a random integer between 1 and 100
        INSERT INTO tmp_test_data
         (date_stamp, value)
        VALUES (TRUNC(SYSDATE)-i, dbms_random.VALUE(1,100));
      END LOOP;
    END;
    SELECT NULL link, CASE WHEN MOD(day,7) = 0 THEN day ELSE NULL END label, value
      FROM (SELECT date_stamp, value, ROW_NUMBER() OVER (ORDER BY date_stamp) day
             FROM tmp_test_data a
             WHERE date_stamp >= TRUNC(SYSDATE)-90
             ORDER BY date_stamp) b
    ;There may be a better way to do this. I know this will work.
    Mike

  • Show number above point in line chart

    My co-worker who is supervising me said there's a way to do this because he's seen it done before, but I looked in all the GUI controls for my report and couldn't find it.  Of course, numbers appear automatically on the vertical axis, but how do you
    get numbers for your points to appear above the data points in your line chart?
    I am using SQL Server 2012 and Visual Studio 2013, I think .NET Framework 4.0

    Hi,
    If I understand correctly, you want to display the data label in the chart. To display the data label:
    On the design surface, right-click the line in the chart and select Show Data Labels.
    Hope it helps.
    Tracy Cai
    TechNet Community Support

  • Scatter chart with lines between points

    In one of our Deski reports, we have a "funnel" chart.  This is essentially achieved with a scatter plot graph with lines drawn between the scatter points to resemble a line chart.  This allows us to draw odd lines, such as a funnels that don't really look like funnels.    (Picture drawing a concentric circle for another visualization of what we are trying to accomplish).  So our problem is that we need to convert this Deski Report to Webi in order to move to BusinessObjects 4.1.  But we cannot seem to achieve this in Webi because the scatter plot in Webi does not draw lines between the points.  Any ideas out there?  Can this be done in a current BusinessObjects tool?

    Hi,
    We have the same problem, did you solve your problem and how?
    thanks in advanced

  • Flash line chart: manipulating the line and data point

    In Apex 3.1 Flash line chart
    Is there a way to change the line thickness and suppress the circular data point? We think it looks cartoonish and ugly especially when there are many data points.
    Thanks,
    Fred

    Hello,
    Use Custom XML in the Chart attributes and replace the line_chart section with:
          <line_chart left_space="5" right_space="5">
            <block_names enabled="no" />
            <dots type='circle' radius='2' />
            <lines size='1' auto_color='yes' tone='0xFFC700' color='0xC1C1C1' />
          </line_chart>I've put the example here also: http://examples.apex-evangelists.com/pls/apex/f?p=286:34:0
    If you come to ODTUG, OOW or our "European Apex Training Days" I'll go into more depth about all this.
    Regards,
    Dimitri
    -- http://dgielis.blogspot.com/
    -- http://eurotraining.apex-evangelists.com/
    -- http://apexblogs.info/

  • Line charts: data point symbol resize?

    I'm working with charts in Pages and would like to be able to have a greater variety of lines in my line chart. In addition to selecting the data point symbol (square, circle, etc), I wish I could resize that symbol. I know I can resize the line width from the Graphic tab of the Inspector.
    Is there a way to shrink the data point symbol from the Inspector? From anywhere?

    If I understand your question, this from the Pages online help may give the answer:
    To mark line, area, and scatter charts with data point symbols:
    Select the entire chart. You can also select the chart series (the line or area shape) that you want to mark with data point symbols.
    Click Inspector in the toolbar, and then click the Chart Inspector button.
    Click Series (except for scatter charts).
    Choose a symbol from the Data Point Symbol pop-up menu.
    Choose one of the following options from the Symbol Fill pop-up menu:
    To fill the symbol with the same color as its outline, choose Use Stroke Color.
    To fill the symbol with a solid color, choose Color Fill, click the Fill color well, and pick a color.
    To fill the symbol with a gradient, choose Gradient Fill and use the gradient controls to set the colors and change the angle of the gradient.
    To fill the symbol with an image, choose Image Fill and select the image you want. You can also resize the image by choosing an option from the pop-up menu above the Choose button.
    To fill the symbol with a tinted image, choose Tinted Image Fill and select the image you want. Click the color well to the right of the Choose button to change the tint color. You can also resize the image by choosing an option from the pop-up menu above the Choose button.

  • How to make a Line Chart curved instead of straight from point-to-point?

    I have a Line Chart that is is very jagged and plots directly from point to point, like this:
    http://img818.imageshack.us/img818/7408/testhb.jpg
    But I want to achieve something that looks a bit smoother where the line instead is curved from point to point, like this:
    http://download.oracle.com/docs/cd/E12839_01/bi.1111/b32122/img/curvedline_graph.gif
    Is this possible in Xcelsius 2008?  I couldn't find anything in the graph's properties and I also had no luck when searching google/these forums for a solution.  Thanks for the help!

    Hello Richard
    I have come across the same scenario today and I saw your .swf file and it was exactly what i was looking for.
    Can you please be kind enough to send me the .XLF fil on <email address removed>
    Thanks
    Arshiyan
    Message was edited by: Ludek Uher
    I removed the email address as this is against the SCN Rules of engagement. Files can be uploaded via the "Use advanced editor" link on each SCN post.

  • Plot empty point in line chart with previous non empty value

    Hello,
    I have a problem to plot series data in SSRS line chart, with the empty point, I don't want use average and zero provided by the report builder, I want use the last non empty data to fill the empty point, tried to use expression =Previous(Field!Value), no
    luck, any one have some good idea?
    P.S. do not want to use query to fill the null with previous non null value, just from the performance point view. at last , the chart should have some line as square wave with different height, if I use average for empty point, it shows slop wave line which
    is not reflect the real production.
    Thanks
    Richard 

    Hi Richard,
    In Reporting Services, if the chart type is a linear chart type (bar, column, scatter, line, area, range), null values are shown on the chart as empty spaces or gaps between data points in a series. By default, empty points are calculated by taking the average
    of the previous and next data points that are not null.
    If we want to use previous value to replace the empty value, please refer to the following steps:
    Right-click the field which displayed in Y axis (Height) to open the Series Properties.
    In the Value field to modify the expression to look like this:
    =iif(isnothing(Sum(Fields!Height.Value)),previous(sum(Fields!Height.Value)),sum(Fields!Height.Value))
    The following screenshot is for your reference:
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Is it possible for a line chart to display curved lines between points?

    We have an interesting request to build a line chart in OBIEE, where the chart points are connected by curved lines instead of the normal straight lines. The best way to describe it would be "snakelike." I've seen this in a Cognos report, but I'm not sure if OBIEE can do this. Maybe a setting within line.pcxml? Any ideas?

    We currently do not provide such a chart. The two options you have for connecting the points in a line chart are either via a straight line or via a step curve. A curved line would basically be a form of a spline curve, with appropriate curve-fitting algorithms.
    Rgds,
    Abhinav
    BI Product Management

Maybe you are looking for

  • Download Error on Creative Cloud?

    I am trying to install the trial cloud.  when I try to get apps it states that there is a Download Error.  I want to try Photoshop specifically. Thank you for any help that can be given

  • Do i need to reconfigure OEM Database Control when change ip address?

    Hi all. Do i need to reconfigure OEM Database Control after a change of ip address? I mean, i have an OEL5 box with 10g Rel2. I have configure the server with a static ip address. This server will be sent to another location and it's possible the ip

  • Change license to Windows 2012 R2 Essentials and Windows 2012 R2 Standard

    Hi, I'm working for a small company (10 users). We have 2 servers; 1 is a normal file server, domain controller etc.; the second is dedicated for running a financial application. We bought and installed new hardware but with so called 'Technet licens

  • Migrating from NDS4.x to iDS5.x in a crossplatform  Environment

    I have a Directory server4.16 installed on the NT4.0.As a part of the migration to solaris platform I have installed the iDS5.1 on my solaris 8 box . I have a custom schem on the Dir4.x NT box . How to migrate this custom schema on the NT box to the

  • Activate Version Management in Purchase Order

    Dear All Expert, Current Condition, Version Management will be activated once the PO has been full released (using t-code ME29N) and then printed (using t-code ME9F). Problem: Condition in our client that they only need particular document that will