Page 1 of 1

Map Image not shown

Posted: Tue Aug 30, 2016 6:16 am
by snOOfy
Hi, I am trying to put a world map image in the background of the chart. I copied the following from the map example, but the image is not displayed. What have I done wrong?

Code: Select all

public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            CreateChart();
        }

        private void CreateChart()
        {            
            //Disable rendering, strongly recommended before updating chart properties
            m_chart.BeginUpdate();

            //Set background photo 
            MapBackground mb = new MapBackground(m_chart.ViewXY.Maps);
            Uri uri = new Uri(AppDomain.CurrentDomain.BaseDirectory + "world.jpg");
            mb.Image = BitmapFrame.Create(uri);
            mb.LatitudeMin = -90;
            mb.LatitudeMax = 90;
            mb.LongitudeMin = -180;
            mb.LongitudeMax = 180;
            mb.Visible = true;
            m_chart.ViewXY.Maps.Backgrounds.Add(mb);            

            //Setup x-axis
            m_chart.ViewXY.XAxes[0].SetRange(-180, 180);
            m_chart.ViewXY.XAxes[0].ValueType = AxisValueType.Number;
            m_chart.ViewXY.XAxes[0].ScrollMode = XAxisScrollMode.None;
            m_chart.ViewXY.XAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.XAxes[0].MajorGrid.Pattern = LinePattern.Solid;
            m_chart.ViewXY.XAxes[0].MajorGrid.Color = Color.FromArgb(40, 0, 0, 0);
            m_chart.ViewXY.XAxes[0].ValueType = AxisValueType.MapCoordsDegNESW;
            m_chart.ViewXY.XAxes[0].Title.Text = "Longitude";

            //Setup y-axis
            m_chart.ViewXY.YAxes[0].SetRange(-90, 90);
            m_chart.ViewXY.YAxes[0].MinorGrid.Visible = false;
            m_chart.ViewXY.YAxes[0].MajorGrid.Pattern = LinePattern.Solid;
            m_chart.ViewXY.YAxes[0].MajorGrid.Color = Color.FromArgb(40, 0, 0, 0);
            m_chart.ViewXY.YAxes[0].ValueType = AxisValueType.MapCoordsDegNESW;
            m_chart.ViewXY.YAxes[0].Title.Text = "Latitude";
            
            //Allow chart rendering
            m_chart.EndUpdate();
        }
    }
XAML:

Code: Select all

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApplication1"
        xmlns:lcu="http://schemas.arction.com/charting/ultimate/" x:Class="WpfApplication1.MainWindow"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <lcu:LightningChartUltimate Name="m_chart"/>
    </Grid>
</Window>

Re: Map Image not shown

Posted: Tue Aug 30, 2016 10:57 am
by ArctionNikolai
Hello,

Thank you for your question.

I have checked the code you have sent. There is no maps in your code, hence you cannot see the MapBackground image. Do you need maps for your application?
If you do not need Maps at all, you can look at "Image Viewer" example. There is a background image that is presented as annotation.

Looking forward hear from you,

Best regards

Re: Map Image not shown

Posted: Tue Aug 30, 2016 2:57 pm
by snOOfy
Thanks for your reply.

My aim is to visualize GPS data. For that I need a zoomable background image like
http://mapsof.net/uploads/static-maps/e ... ection.jpg

and additional images of different countries in higher resolution with given Latitude and Longitude range to be shown in the background. Can I achieve this with annotations?

I did not find an "Image Viewer" example in the LightningChart for WPF Demo Application v.7.0 (Non-bindable).

Re: Map Image not shown

Posted: Tue Aug 30, 2016 9:07 pm
by ArctionPasi
Hi snOOfy,

the image viewer example is included in v.7.1 installers. It's available in our downloads.

When zooming the view, the annotations or map background show only the image you have set to it. It doesn't load higher resolution images automatically from anywhere. So you may want to set a new image when axis ranges are modified or view zoomed.

To zoom map with higher and higher details, we have TileLayers available in our Maps property tree. TileLayers in v.7.1 supports on-line streaming from HERE maps.

Re: Map Image not shown

Posted: Mon Sep 05, 2016 3:29 pm
by snOOfy
Hi,

I implemented the annotations as shown in the example. The solution seems to work, but the annotations or part of them disappear at some zoom levels. Is there a way to fix this?

Re: Map Image not shown

Posted: Tue Sep 06, 2016 6:54 am
by ArctionNikolai
Hello,
I have tried with several releases to reproduce your problem with your sample app, but I couldn't. Zoomed and Panned in all way, but not.

Could you tell me please what release version do you use?

Re: Map Image not shown

Posted: Tue Sep 06, 2016 8:51 am
by snOOfy
I use version 7.0. Maybe it's a problem with my graphics card driver. The World Map example application also has this problem (see screenshot). I will try to run the app on a different computer after my other problem

http://www.arction.com/forum/viewtopic.php?f=16&t=950

is solved.

Re: Map Image not shown

Posted: Tue Sep 06, 2016 11:48 am
by ArctionNikolai
According to your attached screenshot, you are using integrated Intel HD unit, that can cause the problem for rendering, not because of our component. The memory for that kind of devices is very limited. You can try to change device type to Hardware11 or, if didn't help - Software11. Run the chart using specific device in code can be done with this line:

Code: Select all

_chart.ChartRenderOptions.DeviceType = RendererDeviceType.*;
where sign - "*" can be HardwareOnly11D, SoftwareOnly11D.

Software11 rendering will be slower, but LightningChart will utilize CPU resources better than yours IntelHD.

Re: Map Image not shown

Posted: Wed Sep 07, 2016 6:22 am
by snOOfy
Thanks for the reply. I could confirm that there are no rendering errors on other computers. As my company PC will be exchanged for a newer model next month I don't have to worry about this.

Re: Map Image not shown

Posted: Wed Sep 07, 2016 6:55 am
by ArctionNikolai
snOOfy wrote:Thanks for the reply. I could confirm that there are no rendering errors on other computers. As my company PC will be exchanged for a newer model next month I don't have to worry about this.

Great. Try our product with a newer PC hardware.
You can also take an update to v.7.1 or higher to get much performance for your apps.

Best regards