<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="FlexChartDemo.Data.Views.Samples.TooltipsSample"
             xmlns:xuni="clr-namespace:Xuni.Forms.FlexChart;assembly=Xuni.Forms.FlexChart"
             xmlns:sample="clr-namespace:FlexChartDemo.Data.Views;assembly=FlexChart101.Data"
             xmlns:common="clr-namespace:FlexChartDemo.Data.Views.Common;assembly=FlexChart101.Data"
             xmlns:chartcore="clr-namespace:Xuni.Forms.ChartCore;assembly=Xuni.Forms.ChartCore" 
             x:Name="page"
             Padding="10">
  <ContentPage.Resources>
    <ResourceDictionary>
      <common:FlagConverter x:Key="converter" />
    </ResourceDictionary>
  </ContentPage.Resources>
  <StackLayout>
    <Label BindingContext="{x:Reference page}" Text="{Binding Title}" IsVisible="{StaticResource TitleVisible}" HorizontalOptions="Center" Font="Large"/>
    <Grid  VerticalOptions="FillAndExpand">
    <xuni:FlexChart x:Name="chart" ItemsSource="{Binding Data}" BindingX="Name" ChartType="Column" Stacking="Stacked" VerticalOptions="FillAndExpand">
      <xuni:FlexChart.Series>
        <xuni:ChartSeries Binding="Sales" Name="Sales" />
        <xuni:ChartSeries Binding="Expenses" Name="Expenses" />
        <xuni:ChartSeries Binding="Downloads" Name="Downloads" />
      </xuni:FlexChart.Series>

      <xuni:FlexChart.Tooltip>
        <xuni:FlexChartTooltip IsVisible="False" >
          <StackLayout BackgroundColor="#FFFFCA" Padding="5">
            <StackLayout Orientation = "Horizontal">
              <Image Source="{Binding ValueX, Mode=OneWay, Converter={StaticResource converter}" />
              <Label Text="{Binding SeriesName}" TextColor="Black" FontAttributes="Bold" FontSize="14"></Label>
            </StackLayout>
            <Label Text="{Binding Value, StringFormat='{0:c2}'}" TextColor="Black" FontSize="14" HorizontalOptions="Center"></Label>
          </StackLayout>
        </xuni:FlexChartTooltip>
      </xuni:FlexChart.Tooltip>
    </xuni:FlexChart>
    </Grid>
  </StackLayout>
</ContentPage>

