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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:46:46+00:00 2026-05-27T03:46:46+00:00

I have a chart that graphs number of tasks completed versus time. On the

  • 0

I have a chart that graphs number of tasks completed versus time. On the Y-axis, 0 is always included and there is a fixed value that will be the maximum number of tasks. As time progresses, the line of the series climbs up to the maximum value. I can do all this.

What I want to be able to do is allow the user to switch between the Y-axis going from 0 to MAX and 0 to the auto range value. This way they can be zoomed in on just the data and not have the upper half of the graph empty when they are still far from the maximum value.

JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "Progress", dataset, false, true, false);
XYPlot plot = chart.getXYPlot();
plot.getRangeAxis().setRange(new Range(0, TOTAL), false, true);

That line allows me to show the entire value range, but I can’t manage to get the range back to the auto value that sets the upper bound to just higher than the largest value in the series (The way it would render if you don’t set the range at all).

  • 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-05-27T03:46:46+00:00Added an answer on May 27, 2026 at 3:46 am

    As an expedient, you can preserve the default Range:

    Range auto = plot.getRangeAxis().getRange();
    

    and later restore it:

    this.add(new JButton(new AbstractAction("Restore") {
    
        @Override
        public void actionPerformed(ActionEvent e) {
            JFreeChart chart = chartPanel.getChart();
            XYPlot plot = (XYPlot) chart.getPlot();
            plot.getRangeAxis().setRange(auto);
        }
    }), BorderLayout.SOUTH);
    

    Notional example based on org.jfree.chart.demo.TimeSeriesChartDemo1.

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

Sidebar

Related Questions

I have created a line chart using Reporting Services that charts the number of
In Mac Excel 2011 I have a Scrum burndown chart that tracks the number
I have a chart in excel that represents some value over a one day
I have a working chart that graphs sales by week. I'd like to add
I have a line chart that is updated every so and so seconds, similar
I have a WPF Chart that I am dynamically binding a BarSeries to. I
I have a jqPlot pie chart that I am loading by reading an XML
I have chart.png with data in it that I would like to put a
I have a simple JSF line chart that uses PrimeFaces (via jqPlot) library: <p:lineChart
I have a chart generated from Google Charts that can be found here: Chart

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.