File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,10 @@ export default {
8989 enabled: true ,
9090 height: 25 ,
9191 width: 50
92+ },
93+ grid: {
94+ enabled: true ,
95+ gridTicks: 25
9296 }
9397 },
9498 lineGraphData: {
Original file line number Diff line number Diff line change @@ -55,11 +55,12 @@ const Chart = {
5555 * @memberOf Chart
5656 */
5757 drawGrid ( cs ) {
58+ if ( this . chartData . grid && this . chartData . grid . enabled === true ) {
5859 const grid = {
5960 x : [ ] ,
6061 y : [ ]
6162 }
62- for ( let i = this . header ; i < ( this . height - this . header ) * .80 ; i += 100 ) {
63+ for ( let i = this . header ; i < ( this . height - this . header ) * .80 ; i += this . gridTicks ) {
6364 grid . y . push ( i ) ;
6465 }
6566 d3 . select ( `#${ this . chartData . selector } ` )
@@ -73,6 +74,7 @@ const Chart = {
7374 . attr ( 'y2' , d => d )
7475 . style ( 'stroke' , '#D3D3D3' )
7576 . style ( 'stroke-width' , 1 )
77+ }
7678 } ,
7779 /**
7880 * Remove x and y axes
@@ -273,6 +275,17 @@ const Chart = {
273275 width ( ) {
274276 return this . chartData . width || 200 ;
275277 } ,
278+ /**
279+ * Grid Tick getter function
280+ * @memberOf Chart
281+ * @returns {number } gridTicks
282+ */
283+ gridTicks ( ) {
284+ if ( this . chartData . grid && this . chartData . grid . gridTicks != null ) {
285+ return this . chartData . grid . gridTicks ;
286+ }
287+ return 100 ;
288+ } ,
276289 /**
277290 * Get the maxium value for metric
278291 * @memberOf Chart
You can’t perform that action at this time.
0 commit comments