mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 01:17:35 -02:30
Merge pull request #553 from jakemcdermott/bug-5449
use abbreviated month name for dashboard chart
This commit is contained in:
@@ -9,11 +9,12 @@
|
|||||||
'adjustGraphSize',
|
'adjustGraphSize',
|
||||||
'templateUrl',
|
'templateUrl',
|
||||||
'i18n',
|
'i18n',
|
||||||
|
'moment',
|
||||||
'jobStatusGraphData',
|
'jobStatusGraphData',
|
||||||
JobStatusGraph
|
JobStatusGraph
|
||||||
];
|
];
|
||||||
|
|
||||||
function JobStatusGraph($window, adjustGraphSize, templateUrl, i18n, graphDataService) {
|
function JobStatusGraph($window, adjustGraphSize, templateUrl, i18n, moment, graphDataService) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: {
|
scope: {
|
||||||
@@ -72,11 +73,11 @@ function JobStatusGraph($window, adjustGraphSize, templateUrl, i18n, graphDataSe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if(period==="day") {
|
if(period === "day") {
|
||||||
timeFormat="%H:%M";
|
timeFormat="H:M";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
timeFormat = '%m/%d';
|
timeFormat = "MMM D";
|
||||||
}
|
}
|
||||||
graphData.map(function(series) {
|
graphData.map(function(series) {
|
||||||
series.values = series.values.map(function(d) {
|
series.values = series.values.map(function(d) {
|
||||||
@@ -93,7 +94,8 @@ function JobStatusGraph($window, adjustGraphSize, templateUrl, i18n, graphDataSe
|
|||||||
.useInteractiveGuideline(true) //We want nice looking tooltips and a guideline!
|
.useInteractiveGuideline(true) //We want nice looking tooltips and a guideline!
|
||||||
.showLegend(false) //Show the legend, allowing users to turn on/off line series.
|
.showLegend(false) //Show the legend, allowing users to turn on/off line series.
|
||||||
.showYAxis(true) //Show the y-axis
|
.showYAxis(true) //Show the y-axis
|
||||||
.showXAxis(true); //Show the x-axis
|
.showXAxis(true) //Show the x-axis
|
||||||
|
.margin({ right: 32 });
|
||||||
|
|
||||||
job_status_chart.interactiveLayer.tooltip.fixedTop(-10); //distance from the top of the chart to tooltip
|
job_status_chart.interactiveLayer.tooltip.fixedTop(-10); //distance from the top of the chart to tooltip
|
||||||
job_status_chart.interactiveLayer.tooltip.distance(-1); //distance from interactive line to tooltip
|
job_status_chart.interactiveLayer.tooltip.distance(-1); //distance from interactive line to tooltip
|
||||||
@@ -101,8 +103,15 @@ function JobStatusGraph($window, adjustGraphSize, templateUrl, i18n, graphDataSe
|
|||||||
job_status_chart.xAxis
|
job_status_chart.xAxis
|
||||||
.axisLabel(i18n._("TIME"))//.showMaxMin(true)
|
.axisLabel(i18n._("TIME"))//.showMaxMin(true)
|
||||||
.tickFormat(function(d) {
|
.tickFormat(function(d) {
|
||||||
var dx = graphData[0].values[d] && graphData[0].values[d].x || 0;
|
const dx = graphData[0].values[d] && graphData[0].values[d].x || 0;
|
||||||
return dx ? d3.time.format(timeFormat)(new Date(Number(dx+'000'))) : '';
|
|
||||||
|
if (!dx) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
const tickDate = new Date(Number(dx + '000'));
|
||||||
|
|
||||||
|
return moment(tickDate).format(timeFormat);
|
||||||
});
|
});
|
||||||
|
|
||||||
job_status_chart.yAxis //Chart y-axis settings
|
job_status_chart.yAxis //Chart y-axis settings
|
||||||
|
|||||||
Reference in New Issue
Block a user