<% strUser = Session("handle") If Not Request.QueryString("handle") = "" Then strUser = Request.QueryString("handle") End If If strUser = "" Then strUser = "BA97" End If intYear = Year(Now)-1 If Not Request.QueryString("year") = "" Then intYear = Left(Request.QueryString("year"),4) End If strMode = "Sector" If Not Request.QueryString("mode") = "" Then strMode = Request.QueryString("mode") End If Set objData = Server.CreateObject("Scripting.Dictionary") Set objClasses = Server.CreateObject("Scripting.Dictionary") objClasses.Add "Y", "Economy" objClasses.Add "W", "Premium Economy" objClasses.Add "J", "Business" objClasses.Add "F", "First" objClasses.Add "R", "Concorde" intTotal = 0 strSQL = "SELECT differentiator, value " _ & "FROM ba97_summary_stats " _ & "WHERE handle='" & strUser & "' " _ & "AND statistic='sector count' " _ & "AND year=" & intYear If Not strMode = "Sectors" Then strSQL = Replace(strSQL,"sector count","distance flown") End If adoRS.Open strSQL Do While Not adoRS.EOF objData.Add adoRS.fields("differentiator").value, adoRS.fields("value").value adoRS.MoveNext Loop adoRS.Close %> $(function () { var chart; $(document).ready(function() { // Build the chart chart = new Highcharts.Chart({ chart: { renderTo: '<%= strMode %>_pie', plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: 'Classes by <%= strMode %> Flown' }, tooltip: { pointFormat: '{series.name}: {point.percentage}%', percentageDecimals: 0 }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, color: '#000000', connectorColor: '#000000', formatter: function() { return ''+ this.point.name +': '+ Math.round(this.percentage*10)/10 +' %'; } } } }, series: [{ type: 'pie', name: '<%= strMode %> by Class', data: [ <% arrData = objData.Keys For intCount = 0 To UBound(arrData) strOutput = " ['" & objClasses.Item(arrData(intCount)) & "'," & objData.Item(arrData(intCount)) & "]" If intCount < UBound(arrData) Then strOutput = strOutput & "," End If Response.Write strOutput & vbcrlf Next %> ] }] }); }); });