Working with image as principal item

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Little Mike
Newbie
Newbie
Posts: 15
Joined: Tue Mar 09, 2004 5:00 am

Working with image as principal item

Post by Little Mike » Thu Aug 04, 2016 4:29 pm

I'm testing an eval copy of T-Chart .NET, trying to demonstrate proof of concept and suitability of use for our specialized applications. I'm using VS2015, Framework 4.6, C# Winforms. The installation and toolbox interfacing worked OK.

This application uses images as the principal items of interest. I want to do the following things while working with an image. Please tell me if the following tasks are feasible, and HOW to get me started doing this with explicit code samples.



I want to:

1. Load an image into a T-Chart component. Currently, the only way I see to do that is as a background image, which doesn't seem to provide the options I may require out of the box. This is the first place I'll need your help.

2. Scale the image in the T-Chart panel to fit by width, extending vertically as much as necessary to keep the original aspect ratio of the image intact. I may want to change the scaling by programmatically zooming, but always maintaining the original aspect ratio. I may also wish to scroll using visible scroll bars, along both axes as desired. I suspect that either some kind of data or axes definitions will be necessary to cause these things to work, just loading an image as a background image provides no obvious methods of this kind of manipulation.

3. Click on the image at any point, and have T-Chart draw a horizontal line with attributes of my choosing (color and width) at the vertical position of the click, over the image and annotate that line with text. That line needs to be created in such a way that it tracks with the T-Chart canvas position and needs to maintain that relative position as the image is zoomed or scrolled. I need to be able to compute the image pixel row position from that click point.

If you can confirm that these actions can be done, please provide any clues as to how to get started doing them so that I can complete my evaluation of the suitability of T-Chart for our specialized use.

Thanks.

-- Mike R.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Working with image as principal item

Post by Sandra » Mon Aug 08, 2016 2:25 pm

Hello Mike,
1. Load an image into a T-Chart component. Currently, the only way I see to do that is as a background image, which doesn't seem to provide the options I may require out of the box. This is the first place I'll need your help.
To place an image in TChart component you need do something as code below:

Code: Select all

  private void button1_Click(object sender, EventArgs e)
      {
            //AddBackround image
                   
            tChart1.Panel.Image  = Image.FromFile(@"E:\tmp\NET\WindowsFormsApplication3\WindowsFormsApplication3\SteemaImages\Steema.jpg");
           tChart1.Panel.ImageMode = ImageMode.Center;

        }
That helps you to do you as you want.
2. Scale the image in the T-Chart panel to fit by width, extending vertically as much as necessary to keep the original aspect ratio of the image intact. I may want to change the scaling by programmatically zooming, but always maintaining the original aspect ratio. I may also wish to scroll using visible scroll bars, along both axes as desired. I suspect that either some kind of data or axes definitions will be necessary to cause these things to work, just loading an image as a background image provides no obvious methods of this kind of manipulation.
Maybe helps you use the ImageMode to change the ImageMode property to show imatge in your end.
3. Click on the image at any point, and have T-Chart draw a horizontal line with attributes of my choosing (color and width) at the vertical position of the click, over the image and annotate that line with text. That line needs to be created in such a way that it tracks with the T-Chart canvas position and needs to maintain that relative position as the image is zoomed or scrolled. I need to be able to compute the image pixel row position from that click point.
You can get the background image Height, Width or resolution propieties directly from the image and combining it with tChart1.ClickBackground and DrawLine tool you can make your request. Anyway, if you don’t use the DrawLine tool you can draw the line directly in the canvas.
In the demo project you find a simple example how is used drawLine Tool, specifically here:
All Featrues\Welcome !\Tools\Draw Lines
Also, if you are instested, you can upload the image in the ColorGrid Series. It maybe useful to get the column and color values.
You can find an example in the demo project, concretely in, All Features\Welcome !\Chart styles\Statistical\Color Grid\ColorGrid Bitmap


Hoping this helps.
Thanks in advance,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Little Mike
Newbie
Newbie
Posts: 15
Joined: Tue Mar 09, 2004 5:00 am

Re: Working with image as principal item

Post by Little Mike » Fri Aug 19, 2016 7:46 pm

ImageMode does not scale the image. This image is MANY times larger than the size of the visible TeeChart panel, and I wish that image to be scaled so that the width of the image is equal to the width of the panel, with the height being proportioned to preserve the aspect ratio of the original image. I realize that this is not the purpose of the background image, and if you cannot do it, that's fine. You crash in 32 bit anyway as I change the ImageMode back and forth for the image which is a 57 MB TIF file.

Right tool for the right job I always say. Just hoping that we could use TeeChart for this instead of purchasing a different dedicated tool for this purpose.

Thanks for your assistance.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Working with image as principal item

Post by Christopher » Mon Aug 22, 2016 8:34 am

Little Mike wrote:Right tool for the right job I always say. Just hoping that we could use TeeChart for this instead of purchasing a different dedicated tool for this purpose.
Please bear in mind that TeeChart gives unrestricted access to the entirety of the .NET Framework's image processing capabilities, which should enable you to modify your images as you require, e.g.

Code: Select all

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;

      tChart1.BeforeDraw += TChart1_BeforeDraw;
    }

    private void TChart1_BeforeDraw(object sender, Graphics3D g)
    {
      Graphics gg = g.GDIplusCanvas;

      Rectangle rect = tChart1.Bounds;

      gg.DrawImage(Image.FromFile(@"D:\tmp\86-87.png"), rect);
    }
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

Post Reply