Pf 11 Barchart Max Min Y Value

UI Components for JSF
Post Reply
stavrosmachinima
Posts: 11
Joined: 27 Oct 2021, 09:49

30 Nov 2022, 14:02

I want the barchart to be more 'zoomed', so we can focus on the values more. For example in this Image https://imgur.com/T1e5Wzn

I want the max Y value and the min Y value to be +20 and -20 respectively so the height of the bar fits the entire content of the card.
But i cant seem to find the option, to set the max/min like i want and there is always empty space above and below.

I have tried almost every possible way with CartesianLinearTicks, but it doesn't make what i want.
I also tried using the Extender, but it doesn't seem to change any value, no matter how i use it.

Java Code for reference:

Code: Select all

	barModel = initializeData();

        BarChartOptions options=new BarChartOptions();
        CartesianScales cScales=new CartesianScales();
        CartesianLinearAxes linearAxes=new CartesianLinearAxes();
        linearAxes.setStacked(true);
        cScales.addXAxesData(linearAxes);

        options.setScales(cScales);
        Legend legend=new Legend();
        legend.setPosition("bottom");
        options.setLegend(legend);

        Title titleChart=new Title();
        titleChart.setDisplay(true);
        titleChart.setText(title);
        options.setTitle(titleChart);

        Tooltip tooltip=new Tooltip();
        tooltip.setMode("index");
        tooltip.setIntersect(false);
        options.setTooltip(tooltip);
        
        barModel.setOptions(options);
        return barModel;
JSF 2.0
Primefaces 11.0
Tomcat 8.5.57.0
Servlet 3.1
JSP 2.3
Java 1.8.0

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

30 Nov 2022, 16:30

You want the chart to be more zooomed "out" not zoomed "in" right?
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

stavrosmachinima
Posts: 11
Joined: 27 Oct 2021, 09:49

02 Dec 2022, 13:25

I mean zoomed in.
JSF 2.0
Primefaces 11.0
Tomcat 8.5.57.0
Servlet 3.1
JSP 2.3
Java 1.8.0

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

02 Dec 2022, 18:49

See this example: https://www.chartjs.org/docs/latest/sam ... n-max.html

If you just tweak the max to 500 you will see it zoomed out. if you tweak it lower it will zoom in. I think that is what you want?
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

stavrosmachinima
Posts: 11
Joined: 27 Oct 2021, 09:49

07 Dec 2022, 14:07

Perfect! Thank you
JSF 2.0
Primefaces 11.0
Tomcat 8.5.57.0
Servlet 3.1
JSP 2.3
Java 1.8.0

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 34 guests