title: Livecharts - Observable Value
body: <p>I'm using LiveCharts to display a barchart with stock levels. The unit names and stock levels are stored in an access database, and these values are retrieved and put into Lists.</p>
  
  <p>The only thing that should really change is the value of stock so I wanted to track changes of the stock and update the database automatically, giving somewhat live data. </p>
  
  <p>What I want to happen is for the chart to automatically update when the value (stock) changes in the database. I don't want to update the entire table, only the value that has changed so that the animations show on individual bars when they're changed.</p>
  
  <p>I have the following code for loading my database values into the database:</p>
  
  <pre><code>    string[] units = new string[30];
      List&lt;string&gt; subs = new List&lt;string&gt;();
      List&lt;string&gt; line = new List&lt;string&gt;();
      List&lt;double&gt; min = new List&lt;double&gt;();
      List&lt;double&gt; max = new List&lt;double&gt;();
      List&lt;ObservableValue&gt; stock = new List&lt;ObservableValue&gt;();
  
      bool initial = true;
      private void LoadData()
      {
          string strConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Database\subDB.mdb";
  
          using (OleDbConnection conn = new OleDbConnection(strConn))
          {
              conn.Open();
              string strSQL = "SELECT * FROM Units";
              OleDbCommand command = new OleDbCommand(strSQL, conn);
  
              using (OleDbDataReader reader = command.ExecuteReader())
              {
                  while (reader.Read())
                  {
                      if (initial)
                      {
                          subs.Add(reader["Sub"].ToString());
                          line.Add(reader["Line"].ToString());
                          min.Add(Convert.ToDouble(reader["Minimum"]));
                          max.Add(Convert.ToDouble(reader["Maximum"]));
                      }
                          stock.Add(reader["Stock"]);
                  }
              }
              initial = false;
          }
      }
  </code></pre>
  
  <p>Chart setup:</p>
  
  <pre><code>    public void chartSetup()
      {
          cartesianChart1.Series = new SeriesCollection
          {
              new ColumnSeries
              {
                  Title = "Total",
                  Fill = System.Windows.Media.Brushes.Crimson,                 
                  Values = new ChartValues&lt;ObservableValue&gt;(stock)
              }
          };
          cartesianChart1.AxisX.Add(new Axis
          {
              Title = "Unit",
              FontSize = 15,
              Separator = new Separator
              {
                  Step = 1,
                  IsEnabled = false //disable it to make it invisible.
              },
              LabelsRotation = 45,
              Labels = new ChartValues&lt;string&gt;(subs)
          });
  
          cartesianChart1.AxisY.Add(new Axis
          {
              Title = "Total",
              FontSize = 15,
              ShowLabels = true,
              LabelFormatter = value =&gt; value.ToString("N")
          });
      }
  </code></pre>
  
  <p>My issue is that I'm unable to implement ObservableValue for stock. I get the message: "Cannot convert from 'object' to 
  LiveCharts.Defaults.ObservableValue</p>