highcharts图表中级入门:图表手动放大缩小自动切换图表标题(title/subtitle)以及图例(legend)、credits字体示例呈现4 090. //图表放大
2015-02-12 15:44
1096 查看
090. //图表放大 091. function ChartFangDa() { 092. chartWidth += 100; 093. chartHeight += 100; 094. //增加字体大小 统一一次增加2个px 095. chartTitleFontSize += 2; 096. chartSubTitleFontSize += 2; 097. chartLegendFontSize += 2; 098. chartCreditsFontSize += 2; 099. ChartUpdate(); 100. } 101. 102. //图表缩小 103. function ChartSuoXiao() { 104. //保证图表大小不会小于500*400 105. if (chartWidth > 500) { 106. chartWidth -= 100; 107. chartHeight -= 100; 108. //增加字体大小 统一一次减少2个px 109. chartTitleFontSize -= 2; 110. chartSubTitleFontSize -= 2; 111. chartLegendFontSize -= 2; 112. chartCreditsFontSize -= 2; 113. ChartUpdate(); 114. } else { 115. alert("对不起,图表不能再缩小了,再缩小就不漂亮了哦~~!"); 116. } 117. } 118. 119. ///根据变量动态更新图表字体 120. function ChartUpdate() { 121. //设置图表大小 最后一个参数表示是否显示动画效果 122. chart.setSize(chartWidth, chartHeight, false); 123. //设置图表主标题 124. chart.setTitle({ 125. style: { 126. fontSize: chartTitleFontSize 127. } 128. }); 129. //设置副标题 130. chart.setTitle(null, { 131. style: { 132. fontSize: chartSubTitleFontSize 133. } 134. }); 135. //设置右下角所有者样式 136. chart.credits.css({ 137. fontSize:chartCreditsFontSize 138. }); 139. //设置图例样式 140. chart.legend.allItems[0].legendItem.css({ 141. fontSize:chartLegendFontSize 142. }); 143. } 144. //]]> 145. </ script > 146. </ head > 147. < body > 148. < script src = "http://code.highcharts.com/highcharts.js" ></ script > 149. < div id = "container" style = "height: 400px" ></ div > 150. < input type = "button" id = "btnFangDa" value = "高宽各自放大100px" /> 151. 152. < input type = "button" id = "btnSuoXiao" value = "高宽各自缩小100px" /> 153. </ body > 154. </ html > |
相关文章推荐
- highcharts图表中级入门:图表手动放大缩小自动切换图表标题(title/subtitle)以及图例(legend)、credits字体示例呈现2 5、图表重画
- highcharts图表中级入门:图表手动放大缩小自动切换图表标题(title/subtitle)以及图例(legend)、credits字体示例呈现2 5、图表重画
- highcharts图表中级入门:图表手动放大缩小自动切换图表标题(title/subtitle)以及图例(legend)、credits字体示例呈现3 6、完整实例代码:
- highcharts图表放大属性(zoomType)说明以及示例详解
- UIScrollView+UIPageControl+NSTimer实现图片的自动滑动以及用户可手动切换,UIPageControl可点击
- highcharts图表的图例legend怎么改变显示位置
- ECharts图表入门:如何配置ECharts图表相关文件以及基本配置呈现最基本线性图表
- Android Tablayout + viewpager 切换时修改tablayout title(标题)的字体颜色和字体大小
- highcharts图表中级入门之xAxis label:X(横)坐标刻度值过长截断多行(换行)显示问题说明
- highcharts控制图标的图例legend不允许切换
- ViewPager详解(二)——自动轮播和手动切换完整示例
- ECharts图表组件中级入门篇:如何通过Ajax异步获取图表数据赋值于图表并渲染呈现
- Qt实用技巧:QIcon缩放(QPixmap的手动放大和QIcon自动缩小)
- UIScrollView+UIPageControl+NSTimer实现图片的自动滑动以及用户可手动切换,UIPageControl可点击
- ViewPager详解(二)——自动轮播和手动切换完整示例
- Highcharts翻译系列之十五:title标题和subtitle副标题
- highcharts图表高级入门之polar:极地图的基本配置以及一些关键配置说明(转载)
- ECharts图表初级入门篇:如何配置ECharts图表相关文件以及基本配置呈现最基本线性图表
- 今天突然发现blog 中滚动鼠标滑轮,可以自动放大,缩小字体,怎么做的?
- ECharts图表组件中级入门(Axis-axisLabel):图表坐标刻度过多如何设置刻度间隔(interval)以及配置说明