Пример #1
0
 /// <summary>
 /// Create a bar chart
 /// </summary>
 /// <param name="width">Width in pixels</param>
 /// <param name="height">Height in pixels</param>
 /// <param name="orientation">The orientation of the bars.</param>
 /// <param name="style">Bar chart style when using multiple data sets</param>
 public BarChart(int width, int height, BarChartOrientation orientation, BarChartStyle style)
     : base(width, height)
 {
     this.orientation = orientation;
     this.style       = style;
 }
Пример #2
0
 /// <summary>
 /// Create a bar chart
 /// </summary>
 /// <param name="width">Width in pixels</param>
 /// <param name="height">Height in pixels</param>
 /// <param name="orientation">The orientation of the bars.</param>
 /// <param name="style">Bar chart style when using multiple data sets</param>
 public BarChart(int width, int height, BarChartOrientation orientation, BarChartStyle style)
     : base(width, height)
 {
     this.orientation = orientation;
     this.style = style;
 }
Пример #3
0
 public async void createBarGraph(string fileName, string title, int width, int height, List<int[]> data, string[] labels, BarChartOrientation overload, StatType type)
 {
     StorageFolder folder = KnownFolders.PicturesLibrary;
     StorageFile file = await folder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);
     string url = "";
     BarChart chart = new BarChart(width, height, overload, BarChartStyle.Stacked);
     chart.SetTitle(title);
     chart.SetLegend(labels);
     chart.SetDatasetColors(new string[] { "FF0000", "00AA00", "E6E6FA", "333333", "32cd32", "00FF00", "740001" });
     chart.AddAxis(new ChartAxis(ChartAxisType.Left));
     chart.SetData(data);
     chart.AddSolidFill(new SolidFill(ChartFillTarget.Background, @"00000000"));
     url = chart.GetUrl();
     HttpWebRequest lxRequest = (HttpWebRequest)WebRequest.Create(url);
     // returned values are returned as a stream, then read into a string
     String lsResponse = string.Empty;
     using (var lxResponse = await lxRequest.GetResponseAsync())
     {
         using (BinaryReader reader = new BinaryReader(lxResponse.GetResponseStream()))
         {
             byte[] lnByte = reader.ReadBytes(1 * 1024 * 1024 * 10);
             await FileIO.WriteBufferAsync(file, lnByte.AsBuffer());
         }
     }
     using (IRandomAccessStream fileStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read))
     {
         // Set the image source to the selected bitmap 
         BitmapImage bitmapImage = new BitmapImage();
         bitmapImage.DecodePixelWidth = width; //match the target Image.Width, not shown
         bitmapImage.DecodePixelHeight = height;
         await bitmapImage.SetSourceAsync(fileStream);
         if (type == StatType.Age)
         {
             barAge.Source = bitmapImage;
         }
         else if (type == StatType.Ethnicity)
         {
             barEthnic.Source = bitmapImage;
         }
         else if (type == StatType.Fairness)
         {
             barFair.Source = bitmapImage;
         }
         else if (type == StatType.Income)
         {
             barIncome.Source = bitmapImage;
         }
         else
         {
             barWait.Source = bitmapImage;
         }
         //barImg.Source = bitmapImage;
     }
 }