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 9189813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:19:08+00:00 2026-06-17T20:19:08+00:00

I created my own chart with x and y axises. I found the present

  • 0

I created my own chart with x and y axises. I found the present choices of charts did not suite my needs. I have managed to built my chart to my likings and now I would like to add all the components to an object that extends AnchorPane. The end results is that my code compiles with no errors, no runtime errors but I don’t see any of my panes that I created. I was wondering what the correct procedure is to extend AnchorPane.

This is the code inside my class that extends Application. Works like a charm:

        Vector <String[]>  v = new Vector<String[]>();
        double highest_high = 0;
        double lowest_low = 0;
        AnchorPane anchorpane = new AnchorPane();


        double xaxisHeight = 20;
        double yaxisWidth = 60;
        double chartYAdjustment = 40;
        double barGap = 3;
        double bars = 15;
        final Chart chart = new Chart(v, yaxisWidth, xaxisHeight, highest_high, lowest_low, chartYAdjustment, barGap);
        final YAxis yaxis = new YAxis(yaxisWidth, highest_high, lowest_low);
        final XAxis xaxis = new XAxis(xaxisHeight, barGap, bars);

        AnchorPane.setTopAnchor(yaxis, 0.0);
        AnchorPane.setRightAnchor(yaxis, 0.0);
        AnchorPane.setBottomAnchor(yaxis, 20.0);        


        AnchorPane.setLeftAnchor(xaxis, 0.0);
        AnchorPane.setRightAnchor(xaxis, 60.0);
        AnchorPane.setBottomAnchor(xaxis, 0.0);     

        AnchorPane.setLeftAnchor(chart, 0.0);
        AnchorPane.setTopAnchor(chart, 0.0);
        AnchorPane.setBottomAnchor(chart, 0.0);
        AnchorPane.setRightAnchor(chart, 0.0);

        anchorpane.getChildren().addAll(chart, yaxis, xaxis);

        Scene s = new Scene(anchorpane, 800, 400, Color.BLACK);
        stage.setScene(s);
        stage.show();

When I put the code inside a class that extends AnchorPane:

public class Main extends AnchorPane{

    public void Main(){
        Vector <String[]>  v = new Vector<String[]>();
        double highest_high = 0;
        double lowest_low = 0;      

        double xaxisHeight = 20;
        double yaxisWidth = 60;
        double chartYAdjustment = 40;
        double barGap = 3;
        double bars = 15;
        final Chart chart = new Chart(v, yaxisWidth, xaxisHeight, highest_high, lowest_low, chartYAdjustment, barGap);
        final YAxis yaxis = new YAxis(yaxisWidth, highest_high, lowest_low);
        final XAxis xaxis = new XAxis(xaxisHeight, barGap, bars);

        AnchorPane.setTopAnchor(yaxis, 0.0);
        AnchorPane.setRightAnchor(yaxis, 0.0);
        AnchorPane.setBottomAnchor(yaxis, 20.0);        


        AnchorPane.setLeftAnchor(xaxis, 0.0);
        AnchorPane.setRightAnchor(xaxis, 60.0);
        AnchorPane.setBottomAnchor(xaxis, 0.0);     

        AnchorPane.setLeftAnchor(chart, 0.0);
        AnchorPane.setTopAnchor(chart, 0.0);
        AnchorPane.setBottomAnchor(chart, 0.0);
        AnchorPane.setRightAnchor(chart, 0.0);

        getChildren().addAll(chart, yaxis, xaxis);

And then in my class that extends Application I have:

Main main = new Main();
Scene s = new Scene(main, 800, 400, Color.BLACK);
            stage.setScene(s);
            stage.show();

It only displays a black window.

  • 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-17T20:19:09+00:00Added an answer on June 17, 2026 at 8:19 pm

    Figure out what I was doing wrong. I have “void” in my constructor call making a method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anybody know, how to make chart like this? I have not found any
I have created my own Attached Property like this: public static class LabelExtension {
I have created my own customized lots of architecture including n-tier layers for different
I have created my own debugger application. It attaches to a process and creates
I have a module (not created by me) which picks up a quote and
I have created a set of C-strings, supplying my own comparator function because I
I have created my own blocking queue and I'm having some trouble figuring out
I have my own derived WPF DataVisualization chart control and within that control, I
I have an unmanaged C++ library for which I've created a managed C++ wrapper.
I've created my own custom Spider Chart generator using PHP and the GD Library.

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.