Is there a way to display tooltips on an image that is dynamically created. The image is a dynamically created chart that has multiple points and on mouse over on a specific point I need to show additional information via a popup.
I'm using a web forms .net 4.0 and using the System.Drawing and System.Drawing.Imaging namespaces.
If your only output is a flat image, you could try adding a <map> to your page and set the 'title' attribute of each <area> to your tooltip value.
You can learn more about creating maps here: http://www.w3schools.com/tags/tag_map.asp
Essentially, you're defining regions of your image as hot spots.
If you know exactly where the point is, you could create an image map. But will be cumbersome.
How to make an image map:
http://www.javascriptkit.com/howto/imagemap.shtml
I would recommend that you use a Javascript Charting Library, there are tons of them out there. And there are some good free ones.
We are using Highchart
http://www.highcharts.com/products/highstock
But this is not free.
You can use a image map, but in order to do that, you're going to need the exact coordinates and if you're off by just a little bit, it could be messed up. Have you given any thought to using MS Charting? http://www.microsoft.com/download/en/details.aspx?id=14422
With MS Charting, everything is done on the code behind and it generates an image just as the way you're doing it now. The difference is on the backend, when you create the datapoint, you can set the tool tip and several other properties like this:
DataPoint.ToolTip = "Your Tooltip Here";
If you are unfamiliar with them, there is a ton of documentation and samples online.
Good Luck!
Related
I'm trying to modify specific parts of an image when clicking on them in a C# application. I'll describe the situation in detail:
Task
I want to add a graphical element to an existing C# application. The graphic I want to use is a shell, similar to: https://static.vecteezy.com/system/resources/previews/000/658/484/non_2x/snail-shell-on-white-vector.jpg
Each segment of the shell has to react to click events. Given the nature of the graphic, each segment has a unique form and size. There is a total of 189 segments.
Clicking on a segment must call some methods in code behind. Depending on code behind values, segments must be colored in 3 stages (empty, half, full).
Environment
Existing Application is a C# WPF app using .NET framwork 4.5
The graphic only exists on paper, so can only be scanned and used in the app as an image file (of any format)
What I've tried
I loaded the graphic in a WebBrowser element, using it as image in an HTML file. Segments are defined by HTML areas, calls to code behind methods and vice versa via JavaScript.
Where I am:
Almost everything worked. Defining areas is relatively little work. Calling code behind via JavaScript worked surprisingly well. However, I couldn't change the graphic from code behind. HTML areas cannot take CSS properties, so they can't be colored this way. Adding overlays to the DOM onclick would work but would also mean creating 378 additional images (189 segments * 2 states). I'd prefer not to...
What I need:
Some hint how I can manage this. Is there any way to make what I already have work? Or am I totally on the wrong path and there is some entirely different approach I'm not seeing? I'm willing to scrap what I've done so far if I must. Using external libraries/3rd party tools would be OK as long as they're free.
I considered rebuilding the graphic using polygons on a WPF canvas, but wouldn't want the hassle (189 segments all of which have rounded edges...).
Same goes for rebuilding the graphic in SVG, continuing the "web" approach.
Forgoing the graphic and using an abstraction (e.g. a table) is a last resort solution.
I'm building an application where I'm using gMap.net (not google maps). I need a totally physical map where there are no labels. All the mapProviders are showing labels. As in the attached picture you can see few landmarks are there. Is there any way to remove them.
Afaik the map data is provided as is, there's no option of actually peeking into the map layers delivered by the map providers.
If the satellite-only imagery is not an option, have you looked at either of those:
ArcGIS_World_Physical_Map
ArcGIS_World_Shaded_Relief_Map
ArcGIS_World_Terrain_Base_Map
Depending on the zoom level these might be a neutral option.
Maybe this is not the right forum for my question, but I'll try anyway.
I am creating an application where I want the user to be able to fill in values in a table/matrix. The values are then going to be saved to a database I have set up. I want to build this application using Windows Presentation Foundation (WPF). I watched the following video on youtube:
https://www.youtube.com/watch?v=_i4mYXSaD4w and it shows very well what features I want my own application to have. The problem is, the example in the video is made in Winforms...
So, my question, which can be split into three parts, is:
Is there a way to build something equal, similar or better, in WPF?
What/which control(s) should I use? Grid? DataGrid?
How do I use this control?
I am new to WPF, and do not have a good picture of what controls to use. I have read many questions about WPF's DataGrid on StackOverflow as well as other QnA's, but I couldn't understand how to do what I wanted, or even if it was possible. Therefore, I'm very thankful to anyone who can explain and lead me onto the right track.
I suggest you to read this article: http://www.codeproject.com/Articles/30905/WPF-DataGrid-Practical-Examples
I need to find, or create an editor that will handle text and images as objects. For instance I have a 3 line string of text, to be able to move it around and position it within a canvas, also the ability to add an image, and possibly resize it within that canvas. and take the result, and save it, whether I get the the offsets and positions manually, of each of the objects (preferable) , or get the entire canvas as an image, to be able to save and print.
Rulers would be great... Im not trying to re-create Photoshop, but the idea is similar.
I will be doing this in a C# WinForms application, it does seem however that a WPF solution might be better suited, and I think I can have a WPF control within winforms...
Any direction or advice would be greatly appreciated.
Forget winforms. It doesn't support anything. Your best bet is to do it in WPF and if you need, you can integrate it into an existing winforms application via the ElementHost.
Please see my similar answers/samples about this:
https://stackoverflow.com/a/15580293/643085
https://stackoverflow.com/a/15469477/643085
https://stackoverflow.com/a/15821573/643085
Also, see this example with support for zoom, panning and resizing functionality:
https://stackoverflow.com/a/16947081/643085
They're all MVVM based and have some interesting features.
You can easily customize these samples and add ANY type of elements:
images,
geometries,
usable interactive UI elements with functionality (TextBoxes, ComboBoxes, whatever),
text,
videos,
FlowDocuments,
or whatever that's visible on screen)
by adding additional data items and their corresponding DataTemplates.
What I am looking to do in my Windows Forms application (or even WPF). Is to dynamically render an image of a tube, or cylinder (with a 3d look or having some sort of depth for a better visual experience), setting the length and hieght and so on, (also need rulers and such to zoom in and out). But then allow the user to enter some text, which will then be placed on that tube or cylinder, for display purposes, able to scale the text size, to create a visual representation of what it would look like IRL.
Any ideas on where I can start, or some examples I can build off of? This vector type display is new to me, so any help would be appreciated.
This article looked interesting. I would imagine you could tweak it to do what you were after.
http://kindohm.com/technical/WPF3DTutorial.htm
Also I googled "WPF 3D drawing".
If you have the choice WPF is better suited for graphics than WinForms out of the box. Though a good programmer can make WinForms do similar.