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

  • Home
  • SEARCH
  • 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 8678073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:37:10+00:00 2026-06-12T20:37:10+00:00

I have a JSF table which displays activity of users. <p:lineChart id=logins value=#{StatisticsController.weekActivity} legendPosition=e

  • 0

I have a JSF table which displays activity of users.

<p:lineChart id="logins" value="#{StatisticsController.weekActivity}" legendPosition="e"  
                                 title="Weekly Logins" seriesColors="4D94FF, 1975FF, 005CE6, 0047B2" minY="0" maxY="200"/>


public class Statistics implements Serializable {

    private CartesianChartModel weeksActivity;

    public Statistics() {  
        createweeksActivity(); 

    }  

    public CartesianChartModel getweekActivity() {  
        return weeksActivity;  
    }

    private void createweeksActivity() {  
        weeksActivity = new CartesianChartModel();  

        ChartSeries boys = new ChartSeries();  
        boys.setLabel("Active Accounts");  

        boys.set("Monday", 120);  
        boys.set("Tuesday", 100);  
        boys.set("Wednesday", 44);  
        boys.set("Thursday", 150);  
        boys.set("Friday", 120);
        boys.set("Saturday", 82);  
        boys.set("Sunday", 115);  

        ChartSeries girls = new ChartSeries();  
        girls.setLabel("Blocked Accounts");  

        girls.set("Monday", 52);  
        girls.set("Tuesday", 60);  
        girls.set("Wednesday", 110);  
        girls.set("Thursday", 135);  
        girls.set("Friday", 120);
        girls.set("Saturday", 140);  
        girls.set("Saturday", 130);  
        girls.set("Sunday", 140);  

        weeksActivity.addSeries(boys);  
        weeksActivity.addSeries(girls);  
    }  


}

I want to display the current day always last in order. For example:
Now I get this order: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday
If for example today is Wednesday I want to get this order when I open the web page:

Thursday, Friday, Saturday, Sunday, Monday, Tuesday, Wednesday

How I can solve this problem?

EDIT:

I updated the code this way:

private void createweeksActivity()
    {

        weeksActivity = new CartesianChartModel();

        ChartSeries activeAccounts = new ChartSeries();
        activeAccounts.setLabel("Active Accounts");

        ChartSeries blockedAccounts = new ChartSeries();
        blockedAccounts.setLabel("Blocked Accounts");

        GregorianCalendar calendar = new GregorianCalendar();
        DateFormat df = new SimpleDateFormat("EEEE");
        for (int i = 0; i < 7; i++)
        {
            calendar.add(Calendar.DATE, 1);
            System.out.println(df.format(calendar.getTime()));
            activeAccounts.set(df.format(calendar.getTime()), getNumberOfLogins(df.format(calendar.getTime())));
            blockedAccounts.set(df.format(calendar.getTime()), getNumberOfLogins(df.format(calendar.getTime())));
        }       

        weeksActivity.addSeries(activeAccounts);
        weeksActivity.addSeries(blockedAccounts);
    }

    public int getNumberOfLogins(String day){

        // Get here the number of logins using SQL command
        // Example: SELECT * FROM HISTORY WHERE DAY = day;

        return 100;
    }

I suppose that it will work.

  • 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-06-12T20:37:11+00:00Added an answer on June 12, 2026 at 8:37 pm
    GregorianCalendar calendar = new GregorianCalendar();
    DateFormat df = new SimpleDateFormat("EEEE");
    for (int i = 0; i < 7; i++) {
        calendar.add(Calendar.DATE, 1);
        System.out.println(df.format(calendar.getTime()));
    }
    

    A GregorianCalendar represents an instant in time, under our gregorian calendar. Its no-arg constructor initializes it to the current time.

    A DateFormat is used to format dates. You can transform a (Gregorian)Calendar into a Date using its getTime() method. “EEEE” means the day of the week, in its longest form.

    The (Gregorian)Calendar.add() method allows adding a value to any field of the calendar (year, month, date, hour, etc.). Since you want to iterate through the days of the week, I start from tomorrow, and add 1 day at each iteration.

    Everything is available in the javadoc.

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

Sidebar

Related Questions

I have this JSF table which is used to display data. I want to
I have a JSF data table <h:dataTable id=memberTable value=#{bean.pList} border=0 rowClasses=rowEven rowOdd var=item> <h:column
I have such code in my JSF template: <h:form> <table id=users cellspacing=0> <a4j:repeat var=person
i have a jsf page which displays an image from an url http://ichart.finance.yahoo.com/z?s=^NSEI&t=1d&q=l&l=on&z=l&p=s&a=v&p=s i
I have a JSF page that displays a table from an object called TableQuery
I have a dynamic data table in JSF which has multiple input elements which
I have a JSF h:datatable with rows of data: <h:dataTable id=dataTable value=#{SessionsController.dataList} binding=#{table} var=item>
I have this JSF table. I want to add row numbers. <?xml version=1.0 encoding=UTF-8?>
I have JSF code like: <h:inputText id=from value=#{fromToMBean.fromName}/> I would like to get this
Suppose i have JSF page <h:body> <h:form id=formID prependId=false> <h:outputText id=randomID value=#{randomNumber.random}/> <h:commandButton id=buttonID

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.