Skip to content

Commit

Permalink
UX: USe bar chart for admin search logs details page.
Browse files Browse the repository at this point in the history
A bar chart is better when comparing the values across the X axis.
  • Loading branch information
tgxworld committed Mar 29, 2019
1 parent f458cba commit e2ad374
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/assets/javascripts/admin/components/admin-graph.js.es6
Expand Up @@ -3,6 +3,8 @@ import { number } from "discourse/lib/formatter";

export default Ember.Component.extend({
tagName: "canvas",
type: "line",

refreshChart() {
const ctx = this.$()[0].getContext("2d");
const model = this.get("model");
Expand All @@ -14,14 +16,16 @@ export default Ember.Component.extend({
{
data: rawData.map(r => r.y),
label: model.get("title"),
backgroundColor: "rgba(200,220,240,0.3)",
backgroundColor: `rgba(200,220,240,${
this.get("type") === "bar" ? 1 : 0.3
})`,
borderColor: "#08C"
}
]
};

const config = {
type: "line",
type: this.get("type"),
data: data,
options: {
responsive: true,
Expand Down
Expand Up @@ -9,7 +9,7 @@
</h2>

{{#conditional-loading-spinner condition=refreshing}}
{{admin-graph model=model}}
{{admin-graph model=model type="bar"}}

<br><br>
<h2> {{i18n "admin.logs.search_logs.header_search_results"}} </h2>
Expand Down

1 comment on commit e2ad374

@tgxworld
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@techapj Do you recall why we switch to bars and then back to line again?

Line graphs looks bad when trying to compare values across the X-axis.

Screenshot from 2019-03-29 12-15-01

Please sign in to comment.