In order to use mvvm properly you need to get histogram as array of values, that you will show in a chart. Here's an example how to calculate histogram: How to draw histogram using EmguCV and C#
Expose the array as a property of viewmodel. In xaml use ItemsControl with custom ItemTemplate and PanelTemplate to show the chart. Databind ItemsSource to the array. In the ItemTemplate you can have Rectangle with Height databound to the histogram value. Benefit of this is that you can define visual appearance of the chart in xaml, you can add some user interactions and your layout can be responsive when resizing.
Let me know if you need assistance with the xaml.
EDIT:
here's promised example of chart made in pure xaml.
viewmodel:
public class MainWindowViewModel
{
public MainWindowViewModel()
{
ChartValues = Enumerable.Range(1, 10) //replace this with your histogram
.Select(i => (float) i*i)
.ToArray();
}
public float[] ChartValues { get; set; }
}
view:
<ItemsControl ItemsSource="{Binding ChartValues}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Rectangle Height="{Binding }" Width="10" VerticalAlignment="Bottom"
Fill="#eee" Stroke="Gray" Margin="-1.0"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
and the result:
