title: Linechart show info on point tapped
body: <p>I'm implementing a little app with Xamarin Forms for a web page, the thing is that in this web is a linear chart with multiple entries and if the user clicks on a point of the line shows info about that point, as you can see in the picture:</p>
  
  <p><a href="https://i.stack.imgur.com/BMTzt.png" rel="nofollow noreferrer">Web Line Chart</a></p>
  
  <p>After some work, I could create a more or less similar line chart using the OxyPlot.Xamarin.Forms plugin with multiple entries which shows the points</p>
  
  <p><a href="https://i.stack.imgur.com/e6WLo.png" rel="nofollow noreferrer">My App Line Chart</a></p>
  
  <p>This is my code:</p>
  
  <pre><code>        OnPropertyChanged("GraphModel");
  
          var model = new PlotModel
          {
              LegendPlacement = LegendPlacement.Outside,
              LegendPosition = LegendPosition.BottomCenter,
              LegendOrientation = LegendOrientation.Horizontal,
              LegendBorderThickness = 0
          };
          model.PlotType = PlotType.XY;
          model.InvalidatePlot(false);
  
          Dictionary&lt;string, List&lt;Prices&gt;&gt; values = HistoricData[Selected.ProductId];
  
          int colorIndex = 0;
          List&lt;string&gt; x_names = new List&lt;string&gt;();
  
          foreach (var item in values.Keys)
          {
  
              if (item.ToUpper() == Selected.ProductName) { SelectedIndex = colorIndex; }
              var lineSeries = new LineSeries()
              {
                  Title = item,
                  MarkerType = MarkerType.Circle,
              };
              lineSeries.MarkerResolution = 3;
              lineSeries.MarkerFill = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
              lineSeries.MarkerStroke = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
              lineSeries.MarkerSize = 3;
  
              var points = new List&lt;DataPoint&gt;();
  
  
              lineSeries.Color = OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
  
              foreach (var price in values[item])
              {
                  points.Add(new DataPoint(price.Week+price.Year, price.Price));
  
              }
  
              if (ButtonsVisibility.Count == 0)
              {
                  lineSeries.IsVisible = (Selected.ProductName == item.ToUpper()) ? true : false;
              }
              else
              {
                  lineSeries.IsVisible = ButtonsVisibility[colorIndex];
              }
  
  
              lineSeries.ItemsSource = points;
              lineSeries.MarkerType = OxyPlot.MarkerType.Circle;
              model.Series.Add(lineSeries);
              colorIndex++;
          }
  
          NumButtons = colorIndex;
          LinearAxis yaxis = new LinearAxis();
          yaxis.Position = AxisPosition.Left;
          yaxis.MajorGridlineStyle = LineStyle.Dot;
          model.Axes.Add(yaxis);
  
          LineChart = model;
          OnPropertyChanged("GraphModel");
          return LineChart;
  </code></pre>
  
  <p>My doubt is which property I should work with and show at least the value of a concrete point, I have seen the property OnTouchStarted but is only for all the LineSeries and not for a single point. I read in some articles that OxyPlot.Xamarin.Forms include a tracker. I added this line in my code:</p>
  
  <pre><code>lineSeries.TrackerFormatString = "X={2},\nY={4}";
  </code></pre>
  
  <p>Is supposed to show the x and y values on click but doesn't show anything, any suggestion? 
  Should show something like that: <a href="https://i.stack.imgur.com/0TGQq.png" rel="nofollow noreferrer">Tracker info on point</a></p>
  
  <p>From the following example: <a href="https://bytelanguage.net/2018/05/25/custom-tooltip-in-oxyplot/" rel="nofollow noreferrer">Tracker Example</a></p>
  
  <p><strong>Updated Code</strong></p>
  
  <pre><code>public PlotModel GetLineChart()
  {
      OnPropertyChanged("GraphModel");
  
      var model = new PlotModel
      {
          LegendPlacement = LegendPlacement.Outside,
          LegendPosition = LegendPosition.BottomCenter,
          LegendOrientation = LegendOrientation.Horizontal,
          LegendBorderThickness = 0
      };
      model.PlotType = PlotType.XY;
      model.InvalidatePlot(false);
  
      Dictionary&lt;string, List&lt;Prices&gt;&gt; values = HistoricData[Selected.ProductId];
  
      int colorIndex = 0;
      List&lt;string&gt; x_names = new List&lt;string&gt;();
  
      foreach (var item in values.Keys)
      {
  
          if (item.ToUpper() == Selected.ProductName) { SelectedIndex = colorIndex; }
          var lineSeries = new LineSeries()
          {
              Title = item,
              MarkerType = MarkerType.Circle,
              CanTrackerInterpolatePoints = false
  
          };
          lineSeries.MarkerResolution = 3;
          lineSeries.MarkerFill = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
          lineSeries.MarkerStroke = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
          lineSeries.MarkerSize = 3;
  
          var points = new List&lt;DataPoint&gt;();
  
  
          lineSeries.Color = OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
  
          foreach (var price in values[item])
          {
             points.Add(new DataPoint(price.Week+price.Year, price.Price)); 
          }
  
          if (ButtonsVisibility.Count == 0)
          {
              lineSeries.IsVisible = (Selected.ProductName == item.ToUpper()) ? true : false;
          }
          else
          {
              lineSeries.IsVisible = ButtonsVisibility[colorIndex];
          }
  
  
          lineSeries.ItemsSource = points;
          lineSeries.MarkerType = OxyPlot.MarkerType.Circle;
  
          lineSeries.TrackerFormatString = "X={2},\nY={4}";
  
          lineSeries.TextColor = OxyPlot.OxyColor.Parse(SubCategoriesViewModel.AvailableColors[colorIndex]);
          model.Series.Add(lineSeries);
          colorIndex++;
      }
  
      NumButtons = colorIndex;
  
      LinearAxis yaxis = new LinearAxis();
      yaxis.Position = AxisPosition.Left;
      //yaxis.StringFormat = "X={2},\nY={4}";
      yaxis.MajorGridlineStyle = LineStyle.Dot;
      model.Axes.Add(yaxis);
  
      LineChart = model;
      OnPropertyChanged("GraphModel");
      return LineChart;
  
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code> protected async override void OnAppearing()
          {
              await _viewModel.LinearViewModel.GetSubCategoryHistoricWeekPrices(App.ViewModel.LoginViewModel.SesionToken, FROM_DATE, TO_DATE);
              Plot.Model = _viewModel.LinearViewModel.GetLineChart();
              PlotController controller = new PlotController();
              controller.UnbindAll();
              controller.BindTouchDown(PlotCommands.PointsOnlyTrackTouch);
              Plot.Controller = controller;
  
  
  
              AddButtons();
  
  
          }
  </code></pre>
  
  <p>Xaml Declaration for plot view:</p>
  
  <pre><code>&lt;oxy:PlotView 
              Grid.Row="2"
              Grid.RowSpan="2"
              Grid.ColumnSpan="4"            
              x:Name="Plot" /&gt;
  </code></pre>