using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

using C1.Xaml.Chart;

namespace ChartSamples
{
  public sealed partial class Bubble : UserControl
  {
    public Bubble()
    {
      this.InitializeComponent();

      chart.BeginUpdate();

      BubbleOptions.SetScale(chart, BubbleScale.Area);
      BubbleOptions.SetMinSize(chart, new Size(20, 20));
      BubbleOptions.SetMaxSize(chart, new Size(80, 80));

      chart.Data.ItemNames = new string[] 
      { 
        "Sydney - 2000",
        "Athens - 2004",
        "Beijing - 2008",
      };
      chart.View.AxisY.ItemsSource = new string[] { "USA", "China", "Russia" };
      chart.View.AxisX.Min = -0.5; chart.View.AxisX.Max = 2.5;
      chart.View.AxisY.Min = -0.5; chart.View.AxisY.Max = 2.5;
      chart.EndUpdate();
    }
  }

  public class ToolTipConverter : IValueConverter
  {
    public object Convert(object value, Type targetType, object parameter, string language)
    {
      DataPoint dp = value as DataPoint;

      if (dp != null)
        return dp["SizeValues"].ToString() + " medals";

      return value;
    }

    public object ConvertBack(object value, Type targetType, object parameter, string language)
    {
      throw new NotImplementedException();
    }
  }

}
