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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:24:19+00:00 2026-05-24T21:24:19+00:00

my bar chart is always drawn with a gradient color by default. I just

  • 0

my bar chart is always drawn with a gradient color by default. I just want a simple color without any styled effects.

Can anyone help ?

Code:

   final JFreeChart chart = ChartFactory.createBarChart(
        "",         // chart title
        xLabel,               // domain axis label
        yLabel,                  // range axis label
        dataset,                  // data
        PlotOrientation.VERTICAL, // orientation
        true,                     // include legend
        false,                     // tooltips?
        false                     // URLs?
    );

  final CategoryPlot plot = chart.getCategoryPlot();
  // SOMETHING HAS TO BE DONE HERE

  showChart(chart); // Simply shows the chart in a new window

Thanks

  • 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-24T21:24:21+00:00Added an answer on May 24, 2026 at 9:24 pm

    The problem lies in the BarPainter you are using. The JFreeChart version 1.0.13 default is to use GradientBarPainter which adds a metallic-ish look to the bar. If you want the “old” look the solution is to use the StandardBarPainter.

    final CategoryPlot plot = chart.getCategoryPlot();
    ((BarRenderer) plot.getRenderer()).setBarPainter(new StandardBarPainter());
    

    That should do it.

    Alternatively, if you want use JFreeChart’s BarRenderer, you could force it to use the StandardBarPainter by calling the static method setDefaultBarPainter() before initializing your renderer.

    final CategoryPlot plot = chart.getCategoryPlot();
    BarRenderer.setDefaultBarPainter(new StandardBarPainter());
    ((BarRenderer) plot.getRenderer()).setBarPainter(new BarPainter());
    

    If you want more control of the chart you can always build it from the ground up instead of using ChartFactory, but that does require a lot extra code.

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

Sidebar

Related Questions

I just want to know how does facebook makes the chat bar always remains
I have drawn a bar chart without xml.I have to add a button below
I want to use bar chart in web application. I have searched many libraries
i want to show a grapph/bar chart in iphone how do i do this
I want to create a bar-chart, but extraordinary high values should be shortened. An
I want to create a ColumnSeries Bar Chart in WPF using C#. I shall
I am playing with matplotlib - I have a bar chart, and I want
Can anyone recommend a library for chart generation (bar charts, pie charts etc.) which
I am making a bar chart and I want two separate gradients for each
how to change the bar chart color in bar charts? Thanks, AravindakumarThangaraju

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.