Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for flotr2 as an alternative to Google Charts #166

Closed
wants to merge 9 commits into from

Conversation

@d00z3l
Copy link
Contributor

d00z3l commented Apr 7, 2014

I have made changes adding the JavaScript charting library Flotr2 as an alternative to Google Charts. I think it is a much better alternative when you are using it in a corporate environment with no need for external calls. Toggle between Google Charts and Flotr2 in the gitblit.properties file: web.chartType = flotr2 or web.chartType = google. The default is google.

@gitblit
Copy link
Owner

gitblit commented Apr 8, 2014

This is a somewhat frequent request so thanks for tackling it. It looks like the activity graphs are not working properly. If we can get those working properly, then I'll be more interested in merging.

@d00z3l
Copy link
Contributor Author

d00z3l commented Apr 8, 2014

Which one of activity graphs aren't working? Which page?

On 8/04/2014 2:34 PM, James Moger wrote:

This is a somewhat frequent request so thanks for tackling it. It
looks like the activity graphs are not working properly. If we can get
those working properly, then I'll be more interested in merging.


Reply to this email directly or view it on GitHub
#166 (comment).

@gitblit
Copy link
Owner

gitblit commented Apr 8, 2014

Repo summary page.

@d00z3l
Copy link
Contributor Author

d00z3l commented Apr 8, 2014

Can you send a screenshot? What repo are you looking at?

On 8/04/2014 2:53 PM, James Moger wrote:

Repo summary page.


Reply to this email directly or view it on GitHub
#166 (comment).

@d00z3l
Copy link
Contributor Author

d00z3l commented Apr 8, 2014

I have just pushed the changes to fix the summary page.

On 8/04/2014 2:53 PM, James Moger wrote:

Repo summary page.


Reply to this email directly or view it on GitHub
#166 (comment).

@d00z3l
Copy link
Contributor Author

d00z3l commented Apr 8, 2014

Also just fixed Metrics page

On 8/04/2014 2:53 PM, James Moger wrote:

Repo summary page.


Reply to this email directly or view it on GitHub
#166 (comment).

@gitblit
Copy link
Owner

gitblit commented Apr 8, 2014

That looks much better. With all the graphing lib choices, why flotr2? I have nothing against it, just never heard of it.

@kwoot
Copy link

kwoot commented Apr 8, 2014

Cool. Thanks!

op 08-04-14 15:46, Marco Sousa schreef:

here do you have the answer:
http://swizec.com/blog/flotr2-my-favorite-javascript-graph-library/swizec/4558


Reply to this email directly or view it on GitHub
#166 (comment).

Jeroen Baten | EMAIL : JBATEN@I2RS.NL
____ _ __ | web : www.i2rs.nl
| )|)( | tel : +31 (0)345 - 75 26 28
|/_| __) | Molenwindsingel 46, 4105 HK, Culemborg, the Netherlands

@gitblit
Copy link
Owner

gitblit commented Apr 8, 2014

@doozel Here is what I'd like to do, if you are willing...

  1. tweak the activity graphs to use the colors of the original graphs - those are the Gitblit colors - the dark navy blue & the orange.
  2. I'd like to see x-axis labels so I don't have to mouse-hover over points - although I do like that feature. If this becomes a layout or size problem, we'll skip it.
  3. Add % to the pie chart labels, as an engineer unit-less numbers make me cringe. :)
  4. Dump all the GoogleChart code, including your new setting. I don't see a reason to continue offering GoogleCharts with a working, self-hosted charting solution that is faster and substantially equivalent.
  5. Is there a way to specify an onclick handler for the pie charts? I've long had this idea to jump to the repo summary page from a pie chart click. We'll skip it if can't be done or if it requires ugly hacks.
@d00z3l
Copy link
Contributor Author

d00z3l commented Apr 8, 2014

Only because I have used it before and I think it works well.

On 8/04/2014 11:44 PM, James Moger wrote:

That looks much better. With all the graphing lib choices, why flotr2?
I have nothing against it, just never heard of it.


Reply to this email directly or view it on GitHub
#166 (comment).

@d00z3l
Copy link
Contributor Author

d00z3l commented Apr 9, 2014

The x-axis labels were painful, that is why I excluded them. 1, 3 & 4 I
can do, I will also look at how to do the click event.

On 9/04/2014 12:17 AM, James Moger wrote:

@doozel https://github.com/doozel Here is what I'd like to do, if
you are willing...

  1. tweak the activity graphs to use the colors of the original graphs
    • those are the Gitblit colors - the dark navy blue & the orange.
  2. I'd like to see x-axis labels so I don't have to mouse-hover over
    points - although I do like that feature. If this becomes a layout
    or size problem, we'll skip it.
  3. Add /%/ to the pie chart labels, as an engineer unit-less numbers
    make me cringe. :)
  4. Dump all the GoogleChart code, including your new setting. I don't
    see a reason to continue offering GoogleCharts with a working,
    self-hosted charting solution that is faster and substantially
    equivalent.
  5. Is there a way to specify an onclick handler for the pie charts?
    I've long had this idea to jump to the repo summary page from a
    pie chart click. We'll skip it if can't be done or if it requires
    ugly hacks.


Reply to this email directly or view it on GitHub
#166 (comment).

…justed colors and added click event to repository pie charts
@d00z3l
Copy link
Contributor Author

d00z3l commented Apr 9, 2014

I have made the changes below (1, 3, 4 & 5), I could add a click event
to the repository pie charts. I couldn't do it for the author as you
need to also specify a repository name for the search to work.

On 9/04/2014 12:17 AM, James Moger wrote:

@doozel https://github.com/doozel Here is what I'd like to do, if
you are willing...

  1. tweak the activity graphs to use the colors of the original graphs
    • those are the Gitblit colors - the dark navy blue & the orange.
  2. I'd like to see x-axis labels so I don't have to mouse-hover over
    points - although I do like that feature. If this becomes a layout
    or size problem, we'll skip it.
  3. Add /%/ to the pie chart labels, as an engineer unit-less numbers
    make me cringe. :)
  4. Dump all the GoogleChart code, including your new setting. I don't
    see a reason to continue offering GoogleCharts with a working,
    self-hosted charting solution that is faster and substantially
    equivalent.
  5. Is there a way to specify an onclick handler for the pie charts?
    I've long had this idea to jump to the repo summary page from a
    pie chart click. We'll skip it if can't be done or if it requires
    ugly hacks.


Reply to this email directly or view it on GitHub
#166 (comment).

String displayFormat = "MMM dd";
if(metrics.size() > 0 && metrics.get(0).name.length() == 7){
df = new SimpleDateFormat("yyyy-MM");
displayFormat = "MMM";

This comment has been minimized.

Copy link
@gitblit

gitblit Apr 9, 2014

Owner

Let's change this to displayFormat = "yyyy MMM";

@gitblit
Copy link
Owner

gitblit commented Apr 9, 2014

This looks great! I have a few more tweaks I'd like before merging.

  1. Move the new resources into a flotr or flotr2 dir
  2. The old graph didn't show a blue circle for every data point. Those blue circles actually represent tags so there should two series, I suppose. The normal points (orange line) and the tag points (discrete blue dots). The tag points are determined by metric.tag > 0. I don't have the tag labels, just a count. When we restore tag indicators, then we're ready to merge.
getString("gb.repository"), getString("gb.commits"));
for (Metric metric : repositoryMetrics.values()) {
chart.addValue(metric.name, metric.count);
}
chart.setShowLegend(false);
chart.setClickUrl("../summary/");

This comment has been minimized.

Copy link
@gitblit

gitblit Apr 9, 2014

Owner

String url = urlFor(SummaryPage.class, null).toString() + "?r=";
chart.setClickUrl(url);

getString("gb.repository"), getString("gb.commits"));
for (Metric metric : repositoryMetrics.values()) {
chart.addValue(metric.name, metric.count);
}
chart.setShowLegend(false);
chart.setClickUrl("summary/");

This comment has been minimized.

Copy link
@gitblit

gitblit Apr 9, 2014

Owner

String url = urlFor(SummaryPage.class, null).toString() + "?r=";
chart.setClickUrl(url);

SimpleDateFormat df = new SimpleDateFormat(dateFormat);
df.setTimeZone(getTimeZone());

// Sort the values first

This comment has been minimized.

Copy link
@gitblit

gitblit Apr 9, 2014

Owner

Sorting is unnecessary as the data is already sorted by the metrics generator. And in fact, this sort method doesn't always work and can generate interesting line graphs. :) You should be safe to toss this.

This comment has been minimized.

Copy link
@d00z3l

d00z3l Apr 10, 2014

Author Contributor

All of those changes are complete.

On 9/04/2014 11:00 PM, James Moger wrote:

In src/main/java/com/gitblit/wicket/charting/Flotr2LineChart.java:

  •       String valueName) {
    
  •   super(tagId, title, keyName, valueName);
    
  • }
  • @override
  • protected void appendChart(StringBuilder sb) {
  •   String dName = "data_" + dataName;
    
  •   sb.append("var labels_" + dataName + " = [");
    
  •   if(xAxisIsDate){
    
  •       // Generate labels for the dates
    
  •       SimpleDateFormat df = new SimpleDateFormat(dateFormat);
    
  •       df.setTimeZone(getTimeZone());
    
  •       // Sort the values first
    

Sorting is unnecessary as the data is already sorted by the metrics
generator. And in fact, this sort method doesn't always work and can
generate interesting line graphs. :) You should be safe to toss this.


Reply to this email directly or view it on GitHub
https://github.com/gitblit/gitblit/pull/166/files#r11433892.

@gitblit
Copy link
Owner

gitblit commented Apr 10, 2014

I pushed your commits to ticket-43 for preservation, squashed them, and merged to master. Thanks for working on this, you've just closed issue-283.

@gitblit gitblit closed this Apr 10, 2014
gitblit added a commit that referenced this pull request Sep 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.