Bitmap picture in background of Oxyplot Plots in vb.net

Mar 2, 2014 at 10:07 AM
Hello,

First of all, thank you a lot for the continous development of that amazing Library !

One feature I would like to implement in my application is to put bitmap picture (from a file)
in background of my graphes.
I know it is possible (I had a look at the examples) through annotations but I have difficulties
to do it in VB.net since there is mismatch between Images classes and OxyImage classes.
I'm looking to have a command such as
"Annotation.imageSource.FromFile(Path ...)" but I have difficulties to handle "Stream classes" as input to OxyImage.

I will appreciate if anyone has some example how to put external files as input to OxyImage.

Regards.
Mar 3, 2014 at 1:25 AM
This may help you get most of the way there. I'm not sure about the interpolate property seen below however. I'm still playing with this myself. Note that the bitmap picture I am referencing is included in my project as an embedded resource in lieu of a file/path reference.

Dim m_AssInfo As System.Reflection.Assembly
m_AssInfo = System.Reflection.Assembly.GetExecutingAssembly
Dim ms As Stream = m_AssInfo.GetManifestResourceStream("Test4Tools.purple-top-white-bottom.png")

Dim image0 As OxyImage
image0 = New OxyImage(ms)
ms.Close()

Dim ianno As New ImageAnnotation
ianno.ImageSource = image0
ianno.Opacity = 0.2
ianno.X = New PlotLength(0.5, PlotLengthUnit.RelativeToPlotArea)
ianno.Y = New PlotLength(0.5, PlotLengthUnit.RelativeToPlotArea)
ianno.Width = New PlotLength(1, PlotLengthUnit.RelativeToPlotArea)
ianno.Height = New PlotLength(1, PlotLengthUnit.RelativeToPlotArea)
ianno.Layer = AnnotationLayer.BelowSeries

ianno.HorizontalAlignment = OxyPlot.HorizontalAlignment.Center
ianno.VerticalAlignment = VerticalAlignment.Middle
ianno.Interpolate = True
myModel.Annotations.Add(ianno)
Mar 3, 2014 at 6:51 PM
Thank you very much.
I began to test this approach from the example source on the codeplex website (Source code section) but
do not spend enough time to success. I will try again but it is not straigthforward if I want to change the picture during
execution.
Regards.