I have an MFC application to draw graph using DirectX. Now I have to add the feature to draw the area graph in DirectX.
Now my application draws like this..
I want to include the feature to my graph to look like this..
here I have to fill the graph area with some color.
I have tried DrawPrimitive(). but this could be used to draw the Triangle, rectangle. but in my application I would like to draw graph with random data points.
Is it possible to achieve in DirectX..?
Kindly someone provide your suggestions.
If u need 2d graph's alone Direct2D is a great option,But if you insist on going to 3D for greater animation and illustrative purposes you can uses OpenGL.There are plenty of custom controls for graph illustration purposes based on OpenGL.
For eg:
http://www.codeproject.com/Articles/4346/D-Graph-ActiveX-Control
Opengl has greater flexibility and can serve your needs better since it is of open source.
hope this helps and Good Luck
Related
I need to draw a circle with a radial gradient on the canvas in my custom control (XAML). But Windows::UI::Xaml::Media contains LinearGradientBrush only. I know about design guids but my control requires so feature to the user can see the color gamma.
Below that I need to get:
P.S. I ask how to draw it at least programmaticaly without XAML.
P.P.S. I know that I can draw a picture in some editor with radial gradient and after draw it on the canvas but it seems not good solution for the adaptive design.
You can check the RenderColorPickerHueRing() method for a sample of how you could do it on a CPU in a WriteableBitmap. It's not super fast (at least in the C# version), but at least it saves you from packaging another image with your app or from using DirectX, which is a bit more tricky to get set up correctly and stabilize.
I have some 3D data (xyz coordinates) that I am trying to represent as a 3D bar graph. What is the best way to visualize this in C++? I would also like to display different colors based on the z value. Any information about this would be great.
Thanks in advance.
I imagine you were hoping for a turn-key solution to your problem, but, although I have seen a lot of 3D bar charts over the years, I don't have a library which I can point to and say "just use this." I once watched as researchers virtually walked around on top of a huge 3D bar chart in Second Life, discussing the depth of data exploration only immersion can offer.
The problem is that you need a dynamic view, with mouse input as a minimum. There are some libraries for 3D graphing, but those are for visualizing surfaces, which isn't really what you're after. Here's one with an ActiveX control interface for starters.
So now I'm thinking about graphical APIs, such as OpenGL and DirectX, where you could just draw the geometry yourself. But I'm not sure you know anything about graphics programming, and so getting a single triangle on screen will be a task, let alone 2*5*w*h triangles. No offense - its an actual GD ordeal.
So short of explaining how to do that in any reasonable way, now I'm wondering if I can simply sidestep the issue. You could use any number of graphing libraries to draw a matrix of charts, one for each slice in the grid. Or a 2D color heat map, where the color matches the Z value, as you suggested.
But that's not helpful, because you wanted a 3D bar chart. So maybe I can talk you out of it? While its been shown that people prefer 3D bar charts, they don't perform as well using them, compared to 2D representations. And if you want a 3D representation to be effective, you may need to employ stereo 3D or linked physical models.
I hope my ramblings have at least been amusing.
Not free, but would this fit the bill? https://www.qt.io/blog/2013/11/07/qt-data-visualization-technology-preview-and-charts-1-3-1-release
Maybe: Use R, and a C++ binding library, like Rcpp.
Or perhaps: PLplot.
I need to draw some undirected graphs with different coloured vertices. Previously I have been doing this the tedious way, by drawing every vertex as a circle and every edge as a straight line. Is there a way that I can do this easily by using the Bezier curve function? I have tried to do this, but can't work out how to add vertices to my lines!
I'm guessing you want to create un-directed graphs with curved edges (since you mention Bezier curves).
I find that the easiest way to draw freestyle graphs is to lay down your vertices as circles (copy & paste for consistent size) and then use the "draw freehand lines" option (pencil icon) to connect the dots. Then you send the circles to the front layer, so the lines look like they start and end at the edges of your circles. If you really want to use Bezier curves instead of free hand, then the method applies just the same. Here's a sample I created using the first method.
Hope this helps.
So this answer uses an external tool as part of the process, but the end result is still a (good looking) graph inside of inkscape. So for anyone who wants relatively hassle free graphs inside inkscape (or other software) who stumbles across this question, hopefully this will be useful.
There is a (free) tool called the yEd Graph Editor which allows for simple creation of graphs, and after creating a graph you can copy them to the system clipboard (right-click menu) and paste them into inkscape. It requires installing an additional piece of software, but the process can be much faster than creating them manually in inkscape as yEd makes it easy to deal with things like layout, node style, edge style and similar.
This process works with other image software as well, both those that work in bitmap and vector graphics and yEd works with a wide range of graph types.
I'm trying to develop a custom set of libraries for creating GUIs in Linux, with, you know, widgets, buttons, etc. So I'm now learning to creating user interfaces using X11 and its Xlib. I get to the point of having a nice window of a size specified, at a position specified, of a specified background color, and the possibility of drawing points, rectangles, arcs. However as I drew my first circle I got really disappointed by the fact that the circle is not antialiased. I can see every single pixel as a square.
Now the question is easy. Is there any way to tell X: please antialias anything before drawing? Or do I have to avoid using XDrawArc and use a custom function which calls XDrawPoint for each point of the circle? Or there is a third solution?
Thanks in advance.
The short answer is "no". Xlib doesn't do anti-aliasing.
The longer answer is "you can use a higher level API such as Cairo Graphics". It's not necessary to roll your own.
What you encountered are the limitations of the X11 core protocol; technically it would be perfectly possible to add antialiasing to it, but that didn't happen.
Instead there's the XRender extension, that provides nice antialiased primitives. You'll also want to look into Xft to render antialiased text using vector fonts.
You can roll your own antialiasing algorithm. You have the only 2 primitives you need: 1) a function to draw TrueColor points (namely, xcb_poly_point(), if you're using XCB), and 2) for loops.
I would like to know how to create 'cylinder effect', like the top site feature in safari 4, here is a picture
http://www.macworld.com/article/139022/2009/02/safari4firstlook.html
Can you tell me what should i learn , how to get started?
I would start by working through the OpenGL tutorials on NeHe's website. You might also want to invest in the Red Book. Topics you'll be interested in: Geometry and texture mapping. I think NeHe even has an example of texture mapping on a cylinder.
Depending on what you hope to accomplish, you might be able to use the Visualization Toolkit to draw a texture on a cylinder in 100 lines of code or less. There's a bit of a learning curve to VTK (and OpenGL for that matter), but the vtkTextureMapToCylinder class and the TCL example of how to use it are good places to get started.
Please download iCarousel. It has many types of cylindrical effects in it.Use whichever is useful for you.