Change ChartKick Graph Design
Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /usr/www/phpsites/public/yayprogramming/wp-content/plugins/wp-syntax/wp-syntax.php on line 383
Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /usr/www/phpsites/public/yayprogramming/wp-content/plugins/wp-syntax/wp-syntax.php on line 383
Chartkick is an easy to use graphing gem that can include Highcharts or Google Charts. In this post, you’ll see how to change the graph design for Chartkick using Highcharts.
The 3rd paramater should be the library design.
1 | <%= area_chart User.group_by_day.count, library: { } %> |
Inside of Library, you can insert a JSON array with the configs from HighCharts API.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | <div> <%= area_chart User.count, library: { colors: ["rgb(67, 131, 187)", "#90ee7e"], chart: { backgroundColor: 'rgba(255, 255, 255, 0.0)', height: '370', style: { fontFamily: "'Unica One', sans-serif" }, plotBorderColor: '#606063' }, title: { text: 'Month Impressions', style: { color: 'rgba(255, 255, 255, 0.8)', fontSize: '22px' } }, subtitle: { text: 'Total Impressions in the last 30 days', style: { color: 'rgba(255, 255, 255, 0.3)', textTransform: 'uppercase' } }, xAxis: { gridLineColor: 'rgba(255, 255, 255, 0.05)', labels: { style: { color: '#E0E0E3' } }, lineColor: 'rgba(255, 255, 255, 0.05)', minorGridLineColor: '#505053', tickColor: '#707073', title: { style: { color: '#A0A0A3' } } }, yAxis: { gridLineColor: 'rgba(255, 255, 255, 0.05)', labels: { style: { color: '#E0E0E3' } }, lineColor: 'rgba(255, 255, 255, 0.05)', minorGridLineColor: 'rgba(255, 255, 255, 0.05)', tickColor: '#707073', tickWidth: 1, title: { style: { color: '#A0A0A3' } } }, tooltip: { backgroundColor: 'rgba(0, 0, 0, 0.85)', style: { color: '#F0F0F0' } }, plotOptions: { series: { dataLabels: { color: '#B0B0B3' }, marker: { lineColor: '#333' } }, boxplot: { fillColor: '#505053' }, candlestick: { lineColor: 'white' }, errorbar: { color: 'white' } }, legend: { itemStyle: { color: '#E0E0E3' }, itemHoverStyle: { color: '#FFF' }, itemHiddenStyle: { color: '#606063' } }, credits: { style: { color: '#666' } }, labels: { style: { color: '#707073' } }, drilldown: { activeAxisLabelStyle: { color: '#F0F0F3' }, activeDataLabelStyle: { color: '#F0F0F3' } }, navigation: { buttonOptions: { symbolStroke: '#DDDDDD', theme: { fill: '#505053' } } }, rangeSelector: { buttonTheme: { fill: '#505053', stroke: '#000000', style: { color: '#CCC' }, states: { hover: { fill: '#707073', stroke: '#000000', style: { color: 'white' } }, select: { fill: '#000003', stroke: '#000000', style: { color: 'white' } } } }, inputBoxBorderColor: '#505053', inputStyle: { backgroundColor: '#333', color: 'silver' }, labelStyle: { color: 'silver' } }, navigator: { handles: { backgroundColor: '#666', borderColor: '#AAA' }, outlineColor: '#CCC', maskFill: 'rgba(255,255,255,0.1)', series: { color: '#7798BF', lineColor: '#A6C7ED' }, xAxis: { gridLineColor: '#505053' } }, scrollbar: { barBackgroundColor: '#808083', barBorderColor: '#808083', buttonArrowColor: '#CCC', buttonBackgroundColor: '#606063', buttonBorderColor: '#606063', rifleColor: '#FFF', trackBackgroundColor: '#404043', trackBorderColor: '#404043' }, legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', background2: '#505053', dataLabelsColor: '#B0B0B3', textColor: '#C0C0C0', contrastTextColor: '#F0F0F3', maskColor: 'rgba(255,255,255,0.3)' } %> </div> |
Ruby on Rails
Next Post
Ruby on Rails on NFOservers.com
Uncategorized