Map Image not shown

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

snOOfy
Posts: 14
Joined: Mon Aug 29, 2016 5:45 pm

Map Image not shown

Post by snOOfy » Tue Aug 30, 2016 6:16 am

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>

User avatar
ArctionNikolai
Posts: 38
Joined: Fri Feb 05, 2016 11:37 am
Location: Finland

Re: Map Image not shown

Post by ArctionNikolai » Tue Aug 30, 2016 10:57 am

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
Nikolai Arsenov
Software developer
Arction Ltd
Microkatu 1, 70210 Kuopio, Finland

snOOfy
Posts: 14
Joined: Mon Aug 29, 2016 5:45 pm

Re: Map Image not shown

Post by snOOfy » Tue Aug 30, 2016 2:57 pm

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).

User avatar
ArctionPasi
Posts: 1365
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland

Re: Map Image not shown

Post by ArctionPasi » Tue Aug 30, 2016 9:07 pm

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.
LightningChart Support Team, PT

snOOfy
Posts: 14
Joined: Mon Aug 29, 2016 5:45 pm

Re: Map Image not shown

Post by snOOfy » Mon Sep 05, 2016 3:29 pm

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?
Attachments
WpfApplication1.zip
Solution including images
(58.01 KiB) Downloaded 383 times
Screenshot of the problem
Screenshot of the problem
problem.png (91.42 KiB) Viewed 15393 times

User avatar
ArctionNikolai
Posts: 38
Joined: Fri Feb 05, 2016 11:37 am
Location: Finland

Re: Map Image not shown

Post by ArctionNikolai » Tue Sep 06, 2016 6:54 am

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?
Nikolai Arsenov
Software developer
Arction Ltd
Microkatu 1, 70210 Kuopio, Finland

snOOfy
Posts: 14
Joined: Mon Aug 29, 2016 5:45 pm

Re: Map Image not shown

Post by snOOfy » Tue Sep 06, 2016 8:51 am

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.
Attachments
Screenshot of World Map example
Screenshot of World Map example
map-example.jpg (80.96 KiB) Viewed 15388 times

User avatar
ArctionNikolai
Posts: 38
Joined: Fri Feb 05, 2016 11:37 am
Location: Finland

Re: Map Image not shown

Post by ArctionNikolai » Tue Sep 06, 2016 11:48 am

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.
Nikolai Arsenov
Software developer
Arction Ltd
Microkatu 1, 70210 Kuopio, Finland

snOOfy
Posts: 14
Joined: Mon Aug 29, 2016 5:45 pm

Re: Map Image not shown

Post by snOOfy » Wed Sep 07, 2016 6:22 am

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.

User avatar
ArctionNikolai
Posts: 38
Joined: Fri Feb 05, 2016 11:37 am
Location: Finland

Re: Map Image not shown

Post by ArctionNikolai » Wed Sep 07, 2016 6:55 am

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
Nikolai Arsenov
Software developer
Arction Ltd
Microkatu 1, 70210 Kuopio, Finland