Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9103905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:44:22+00:00 2026-06-17T01:44:22+00:00

I haven’t used java since version 4 and casting seams to have changed to

  • 0

I haven’t used java since version 4 and casting seams to have changed to the point where it’s almost annoying. I don’t understand how to approach the following compile error.

HelloWorld.java:70: error: no suitable method found for
add(Series)
lineChart.getData().add(series);
^
method List.add(int,Series) is not applicable
(actual and formal argument lists differ in length)
method List.add(Series) is not applicable
(actual argument Series cannot be converted to Series by method invocation conversion)

Here is my code:

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.chart.*;
import javafx.stage.Stage;
import javafx.geometry.Side;
import java.lang.*;
import java.net.*; 
import java.io.*;
import java.util.*;




public class HelloWorld extends Application {

    @Override public void start(Stage stage) {


        Vector <String[]>  v = new Vector<String[]>();

        try{

                File f = new File("audjpy.txt"); 
                BufferedReader br = new BufferedReader(new FileReader(f));
                String line;
                String[] data;
                int count = 0;
                while ((line = br.readLine()) != null) {
                        data = line.split(",");
                        if(count>0)v.add(data);
                        if(count == 400)break;
                        count++;
                }
                br.close();
        }catch(IOException e){System.out.println(e);}




        stage.setTitle("Line Chart Sample");
        //defining the axes
        NumberAxis xAxis = new NumberAxis();
        NumberAxis yAxis = new NumberAxis();
        yAxis.setSide(Side.RIGHT);
        xAxis.setLabel("Number of Month");
        //creating the chart
        final LineChart<Number,Number> lineChart = 
                new LineChart<Number,Number>(xAxis,yAxis);

        lineChart.setTitle("Stock Monitoring, 2010");

        //defining a series
        XYChart.Series<Double, Double> series = new XYChart.Series<Double, Double>();
        series.setName("My portfolio");

        //populating the series with data
        //<TICKER>,<DTYYYYMMDD>,<TIME>,<OPEN>,<HIGH>,<LOW>,<CLOSE>,<VOL>
    Enumeration<String[]> e = v.elements();
    while(e.hasMoreElements()){
        String[] data = e.nextElement();
            double x = Double.parseDouble(data[4]);
            double y = Double.parseDouble(data[5]);
            series.getData().add(new XYChart.Data<Double, Double>(x,y));
        }

        Scene scene  = new Scene(lineChart,800,600);
        lineChart.getData().add(1, series);

        stage.setScene(scene);
        stage.show();
    }


    public static void main(String[] args) {
        launch(args);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:44:23+00:00Added an answer on June 17, 2026 at 1:44 am

    The reasons seems like it is because you are using Double and Number interchangeable, change every generic to Number and your problem should be solved.

    @Override
    public void start(Stage stage) {
    
    
        Vector<String[]> v = new Vector<String[]>();
    
        try {
    
            File f = new File("audjpy.txt");
            BufferedReader br = new BufferedReader(new FileReader(f));
            String line;
            String[] data;
            int count = 0;
            while ((line = br.readLine()) != null) {
                data = line.split(",");
                if (count > 0) {
                    v.add(data);
                }
                if (count == 400) {
                    break;
                }
                count++;
            }
            br.close();
        } catch (IOException e) {
            System.out.println(e);
        }
    
    
    
    
        stage.setTitle("Line Chart Sample");
        //defining the axes
        NumberAxis xAxis = new NumberAxis();
        NumberAxis yAxis = new NumberAxis();
        yAxis.setSide(Side.RIGHT);
        xAxis.setLabel("Number of Month");
        //creating the chart
        final LineChart<Number, Number> lineChart = new LineChart<Number, Number>(xAxis, yAxis);
    
        lineChart.setTitle("Stock Monitoring, 2010");
    
        //defining a series
        XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
        series.setName("My portfolio");
    
        //populating the series with data
        //<TICKER>,<DTYYYYMMDD>,<TIME>,<OPEN>,<HIGH>,<LOW>,<CLOSE>,<VOL>
        Enumeration<String[]> e = v.elements();
        while (e.hasMoreElements()) {
            String[] data = e.nextElement();
            double x = Double.parseDouble(data[4]);
            double y = Double.parseDouble(data[5]);
            series.getData().add(new XYChart.Data<Number, Number>(x,y));
        }
    
        Scene scene = new Scene(lineChart, 800, 600);
        lineChart.getData().add(1, series);
    
        stage.setScene(scene);
        stage.show();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

haven't used regex replaces much and am not sure if how I have done
Haven't used C++ in a while. I've been depending on my Java compiler to
Haven't done serious JavaScript since 90s, so looks like a couple of things changed.
I haven't used the STL much before, but I started to on this huffman
I haven't used ARC yet other than to deal with it when it forces
I haven't used multithreading in Clojure at all so am unsure where to start.
Haven't done as much of Javascript as I should have done. I am trying
Haven't found a working solution as of yet. I have three different versions of
Haven't found a similar question, if one exists, please point me to it. Basically
Haven't seen anything, but I have seen that you can create albums in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.