qt qml qchart 圖表組件spa
* Author: Julien Wintz
* Created: Thu Feb 13 23:41:59 2014 (+0100).net
這玩意是從chart.js遷移到qml的,簡單易用好看code
【先看效果】blog
【下載】qt
http://download.csdn.net/detail/surfsky/8426601io
【調用代碼示例】ast
先class
1 import "QChart.js" as Charts
好了,展現你的圖表import
1 // 折線圖 2 Chart { 3 id: chart_line; 4 width: chart_width; 5 height: chart_height; 6 chartAnimated: true; 7 chartAnimationEasing: Easing.InOutElastic; 8 chartAnimationDuration: 2000; 9 chartData: ChartsData.ChartLineData; 10 chartType: Charts.ChartType.LINE; 11 } 12 13 // 極座標圖 14 Chart { 15 id: chart_polar; 16 width: chart_width; 17 height: chart_height; 18 chartAnimated: true; 19 chartAnimationEasing: Easing.InBounce; 20 chartAnimationDuration: 2000; 21 chartData: ChartsData.ChartPolarData; 22 chartType: Charts.ChartType.POLAR; 23 } 24 25 // 雷達圖 26 Chart { 27 id: chart_radar; 28 width: chart_width; 29 height: chart_height; 30 chartAnimated: true; 31 chartAnimationEasing: Easing.OutBounce; 32 chartAnimationDuration: 2000; 33 chartData: ChartsData.ChartRadarData; 34 chartType: Charts.ChartType.RADAR; 35 } 36 37 // 餅圖 38 Chart { 39 id: chart_pie; 40 width: chart_width; 41 height: chart_height; 42 chartAnimated: true; 43 chartAnimationEasing: Easing.Linear; 44 chartAnimationDuration: 2000; 45 chartData: ChartsData.ChartPieData; 46 chartType: Charts.ChartType.PIE; 47 } 48 49 // 柱形圖 50 Chart { 51 id: chart_bar; 52 width: chart_width; 53 height: chart_height; 54 chartAnimated: true; 55 chartAnimationEasing: Easing.OutBounce; 56 chartAnimationDuration: 2000; 57 chartData: ChartsData.ChartBarData; 58 chartType: Charts.ChartType.BAR; 59 } 60 61 // 環形圖 62 Chart { 63 id: chart_doughnut; 64 width: chart_width; 65 height: chart_height; 66 chartAnimated: true; 67 chartAnimationEasing: Easing.OutElastic; 68 chartAnimationDuration: 2000; 69 chartData: ChartsData.ChartDoughnutData; 70 chartType: Charts.ChartType.DOUGHNUT; 71 }