UX: USe bar chart for admin search logs details page.

A bar chart is better when comparing the values across the X axis.
This commit is contained in:
Guo Xiang Tan 2019-03-29 11:54:49 +08:00
parent f458cba4cb
commit e2ad374e5b
2 changed files with 7 additions and 3 deletions

View File

@ -3,6 +3,8 @@ import { number } from "discourse/lib/formatter";
export default Ember.Component.extend({ export default Ember.Component.extend({
tagName: "canvas", tagName: "canvas",
type: "line",
refreshChart() { refreshChart() {
const ctx = this.$()[0].getContext("2d"); const ctx = this.$()[0].getContext("2d");
const model = this.get("model"); const model = this.get("model");
@ -14,14 +16,16 @@ export default Ember.Component.extend({
{ {
data: rawData.map(r => r.y), data: rawData.map(r => r.y),
label: model.get("title"), 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" borderColor: "#08C"
} }
] ]
}; };
const config = { const config = {
type: "line", type: this.get("type"),
data: data, data: data,
options: { options: {
responsive: true, responsive: true,

View File

@ -9,7 +9,7 @@
</h2> </h2>
{{#conditional-loading-spinner condition=refreshing}} {{#conditional-loading-spinner condition=refreshing}}
{{admin-graph model=model}} {{admin-graph model=model type="bar"}}
<br><br> <br><br>
<h2> {{i18n "admin.logs.search_logs.header_search_results"}} </h2> <h2> {{i18n "admin.logs.search_logs.header_search_results"}} </h2>