Skip to content
Snippets Groups Projects
Verified Commit aa7dd230 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Tweak the insights JS to supports line and pie charts


Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 8bf9ad15
No related branches found
No related tags found
No related merge requests found
Pipeline #50618125 failed
This commit is part of merge request !9776. Comments created here will be created in the context of that merge request.
......@@ -18,6 +18,10 @@ export default class ChartBuilder {
return this.stackedBar();
case 'bar':
return this.bar();
case 'line':
return this.line();
case 'pie':
return this.pie();
default:
return '';
}
......@@ -62,6 +66,28 @@ export default class ChartBuilder {
};
}
line() {
return {
type: 'line',
data: this.chartData,
options: {
...chartOptions.barChartOptions(),
...this.moreChartOptions(),
},
};
}
pie() {
return {
type: 'pie',
data: this.chartData,
options: {
...chartOptions.barChartOptions(),
...this.moreChartOptions(),
},
};
}
moreChartOptions() {
return {
title: {
......
......@@ -32,8 +32,9 @@ export const fetchChartData = ({ dispatch, state }, endpoint) => {
return axios
.post(endpoint, {
name: activeChart.name,
params: activeChart.query,
name: activeChart.query.name,
query: activeChart.query.params,
chart_type: activeChart.type,
})
.then(({ data }) => dispatch('requestChartDataSuccess', data))
.catch(error => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment