Bar Chart

Post Reply
joao_arthur
Posts: 36
Joined: 09 Mar 2015, 15:40

27 Apr 2017, 19:07

Please, I need to change the color of the series value label of a bar chart, I can change the formatting of the values but I can not change the color of the label, how can I change it ? And if it is possible to change the position of the label, it currently stays on top of the bar of the series but I want it to be on the bottom or inside the bar

joao_arthur
Posts: 36
Joined: 09 Mar 2015, 15:40

28 Apr 2017, 14:15

Sentinel does not have technical support?

User avatar
aragorn
Posts: 3081
Joined: 29 Jun 2013, 12:38

01 May 2017, 11:58

Sentinel have technical support. But, this issue isn't a Layout or Theme issue. Next time, please use core Primefaces forum for these issues;
viewforum.php?f=3

PrimeFaces charts use jqplot API. Therefore, You can check jqplot API;
Exp; http://www.jqplot.com/examples/point-labels.php

Also, you can examine our sample chart.xhtml page;
https://www.primefaces.org/eos/sentinel/charts.xhtml

Code: Select all

//JS code
function skinBar() {
                this.cfg.shadow = false;
                this.cfg.title = '';
                this.cfg.seriesColors = ['#2BB673', '#F15732'];
                this.cfg.grid = {
                    background: '#ffffff',
                    borderColor: '#ffffff',
                    gridLineColor: '#F5F5F5',
                    shadow: false
                };
                this.cfg.axesDefaults = {
                    rendererOptions: {
                        textColor: '#666F77'
                    }
                };
                this.cfg.seriesDefaults = {
                    shadow: false,
                    lineWidth: 1,
                    renderer: $.jqplot.BarRenderer,
                    markerOptions: {
                        shadow: false,
                        size: 7,
                        style: 'circle'
                    }
                }
}

//XHTML
<p:chart id="bar" type="bar" model="#{chartDemoView.barModel}" responsive="true"/>

//bean
...
private void createBarModel() {
    barModel = initBarModel();

    barModel.setTitle("Bar Chart");
    barModel.setLegendPosition("ne");

    Axis xAxis = barModel.getAxis(AxisType.X);
    xAxis.setLabel("Gender");

    Axis yAxis = barModel.getAxis(AxisType.Y);
    yAxis.setLabel("Births");
    yAxis.setMin(0);
    yAxis.setMax(200);

    barModel.setExtender("skinBar");
}
...

Post Reply

Return to “Sentinel”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest