Files
OpenFace/gui/OpenFace-offline/UI_items/BarGraph.xaml.cs

40 lines
975 B
C#
Raw Normal View History

2016-05-20 16:48:43 -04:00
using System.Windows.Controls;
namespace OpenFaceOffline
{
/// <summary>
/// Interaction logic for BarGraph.xaml
/// </summary>
public partial class BarGraph : UserControl
{
private double targetValue = 0;
public BarGraph()
{
InitializeComponent();
}
public void SetValue(double value)
{
targetValue = 1.5 * value;
if (targetValue > 0)
{
if (targetValue > barContainerPos.ActualHeight)
targetValue = barContainerPos.ActualHeight;
barPos.Height = targetValue;
barNeg.Height = 0;
}
if (targetValue < 0)
{
if (-targetValue > barContainerNeg.ActualHeight)
targetValue = -barContainerNeg.ActualHeight;
barPos.Height = 0;
barNeg.Height = -targetValue;
}
}
}
}