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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:57:16+00:00 2026-06-09T14:57:16+00:00

How can I subscribe to a given JFreeChart object to be notified about changes

  • 0

How can I subscribe to a given JFreeChart object to be notified about changes to the series set i.e. a new series inserted or a new data point added to the series?

  • 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-09T14:57:17+00:00Added an answer on June 9, 2026 at 2:57 pm

    For a Dataset:

    Dataset coll = new XYSeriesCollection();
    coll.addChangeListener(new DatasetChangeListener() {
        @Override
        public void datasetChanged(DatasetChangeEvent arg0) {
            // TODO Auto-generated method stub
        }
    });
    

    or for the JFreeChart itself:

    JFreeChart chart = createChart();
    chart.addChangeListener(new ChartChangeListener() {
        @Override
        public void chartChanged(ChartChangeEvent arg0) {
            // TODO Auto-generated method stub
        }
    });
    

    And I am sure, that also works for the Plots in between and the Series at the end.

    EDIT: To only listen for added/removed series:

    final XYSeriesCollection coll = new XYSeriesCollection();
    coll.addChangeListener(new DatasetChangeListener() {
        private int numberOfSeries = -1;
    
        @Override
        public void datasetChanged(DatasetChangeEvent arg0) {
            int numberOfSeriesNew = coll.getSeriesCount();
            if (numberOfSeriesNew == numberOfSeries) {
                // no series was added/removed
            } else if (numberOfSeriesNew < numberOfSeries) {
                // series was removed
                numberOfSeries = numberOfSeriesNew;
            } else {
                // series was added
                numberOfSeries = numberOfSeriesNew;
            }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How would you dynamically subscribe to a C# event so that given a Object
In my class I want to declare an event that other classes can subscribe
Hai every one, I am developing an application where users can subscribe or unsubscribe
I've built a WCF Publish Subscribe Topic Service and can successfully publish/subscribe with a
Similar to the ability to subscribe to a user's posts on Facebook, users can
i was thinking about designing a service that can provide my subscribers feed updates
I'm dealing with a website where people can subscribe to certain things for virtual
Given a Java web application using CometD, how can I publish a message to
Can someone give me an example of creating a custom set of an Event
In a project I'm working on, users can subscribe themselves to a course. 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.