block size chart grid tweaks
This commit is contained in:
parent
1492e00318
commit
9b57b50f9e
1 changed files with 6 additions and 1 deletions
|
@ -134,6 +134,7 @@
|
||||||
var chartData = [];
|
var chartData = [];
|
||||||
var minPeriod = 'hh';
|
var minPeriod = 'hh';
|
||||||
var defaultPeriod = '24h';
|
var defaultPeriod = '24h';
|
||||||
|
var periodGridCounts = {'24h': 24, '72h': 24, '168h': 14, '30d': 30, '90d': 45, '1y': 12 };
|
||||||
AmCharts.ready(function() {
|
AmCharts.ready(function() {
|
||||||
chart = AmCharts.makeChart('block-size-chart', {
|
chart = AmCharts.makeChart('block-size-chart', {
|
||||||
type: 'serial',
|
type: 'serial',
|
||||||
|
@ -165,7 +166,9 @@
|
||||||
categoryAxis: {
|
categoryAxis: {
|
||||||
parseDates: true,
|
parseDates: true,
|
||||||
minPeriod: minPeriod, // DD for daily
|
minPeriod: minPeriod, // DD for daily
|
||||||
|
autoGridCount: false,
|
||||||
minorGridEnabled: true,
|
minorGridEnabled: true,
|
||||||
|
minorGridAlpha: 0.04,
|
||||||
axisColor: '#dadada',
|
axisColor: '#dadada',
|
||||||
twoLineMode: true,
|
twoLineMode: true,
|
||||||
dateFormats: [{
|
dateFormats: [{
|
||||||
|
@ -250,7 +253,6 @@
|
||||||
categoryBalloonDateFormat: minPeriod === 'hh' ? 'D MMM HH:NN ' : 'D MMM'
|
categoryBalloonDateFormat: minPeriod === 'hh' ? 'D MMM HH:NN ' : 'D MMM'
|
||||||
},
|
},
|
||||||
chartScrollbar: {
|
chartScrollbar: {
|
||||||
autoGridCount: true,
|
|
||||||
scrollbarHeight: 36,
|
scrollbarHeight: 36,
|
||||||
color: '#888888',
|
color: '#888888',
|
||||||
gridColor: '#bbbbbb'
|
gridColor: '#bbbbbb'
|
||||||
|
@ -307,9 +309,12 @@
|
||||||
//var dataSet = chart.mainDataSet;
|
//var dataSet = chart.mainDataSet;
|
||||||
if (chart) {
|
if (chart) {
|
||||||
var isHourly = (dataPeriod.indexOf('h') > -1);
|
var isHourly = (dataPeriod.indexOf('h') > -1);
|
||||||
|
var gridCount = periodGridCounts[dataPeriod];
|
||||||
chart.categoryAxis.minPeriod = isHourly ? 'hh' : 'DD';
|
chart.categoryAxis.minPeriod = isHourly ? 'hh' : 'DD';
|
||||||
chart.categoryAxis.dateFormats[4].format = isHourly ? 'DD MMM' : 'DD';
|
chart.categoryAxis.dateFormats[4].format = isHourly ? 'DD MMM' : 'DD';
|
||||||
chart.chartCursor.categoryBalloonDateFormat = isHourly ? 'D MMM HH:NN ' : 'D MMM YYYY';
|
chart.chartCursor.categoryBalloonDateFormat = isHourly ? 'D MMM HH:NN ' : 'D MMM YYYY';
|
||||||
|
chart.categoryAxis.gridCount = gridCount;
|
||||||
|
chart.chartScrollbar.gridCount = periodGridCounts[dataPeriod];
|
||||||
chart.dataProvider = chartData;
|
chart.dataProvider = chartData;
|
||||||
chart.validateNow();
|
chart.validateNow();
|
||||||
chart.validateData();
|
chart.validateData();
|
||||||
|
|
Loading…
Reference in a new issue