Skip to content

CategoryChart y axis wrong on 3.8.7 while bars are correct  #826

@Remi-Lerolle

Description

@Remi-Lerolle
  final CategoryChart chart = new CategoryChartBuilder()
      .width(600)
      .height(400)
      .xAxisTitle("X")
      .yAxisTitle("Y")
      .build();

  ArrayList<String> years =  new ArrayList<String>( Arrays.asList( new String[]{"2012", "2013","2014","2015","2016","2017","2018", "2019", "2020", "2021", "2022"} ) );

  ArrayList<Number> yAData =  new ArrayList<Number>( Arrays.asList( new Number[]{ 4438887, 4365843, 4050498, 4757380, 4429130, 4692889, 4354087, 4530343, 4572770, 4150489, 4487793} ) );

  ArrayList<Number> yBData =  new ArrayList<Number>( Arrays.asList( new Number[]{ 3198714, 3144079, 2859215, 3430605, 3839149, 4042579, 3741823, 3890162, 3731367, 3751216, 4008249} ) );

  chart.getStyler().setOverlapped(true);
  chart.getStyler().setYAxisDecimalPattern( "###,###.##" );

  chart.addSeries("A", years, yAData);
  chart.addSeries("B", years, yBData);

   chart.getStyler().setYAxisMin( 2600000.0 );
   chart.setTitle( Double.toString(2600000.0) );

   try{
     new SwingWrapper<>(chart).displayChart();
    }catch(Exception e){
      System.out.println(e);
    }

works fine with

    <dependency>
      <groupId>org.knowm.xchart</groupId>
      <artifactId>xchart</artifactId>
      <version>3.6.5</version>
    </dependency>

image

while the most recent version of the lib, the bars are OK but the y axis is wrong:

    <dependency>
      <groupId>org.knowm.xchart</groupId>
      <artifactId>xchart</artifactId>
      <version>3.8.7</version>
    </dependency>

image

The opacity of the ultimate bar is also different from the others without reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions