I'm trying to create candle stick chart using zedgraphweb and having below problems.
How to add horizontal scroll bar to chart. There are methods for this for ZEDGRAPH but none in zedgraphweb.
How to refresh just graph to render real time data with out page refresh. Calling this.ZedGraphWeb1.RenderGraph += new ZedGraph.Web.ZedGraphWebControlEventHandler(this.OnRenderGraph); refreshing the entire graph.
How to add tool tips?
Thanks,
Thavva
2) I don't know the differences between zedGraph and zedGraphWeb, but in zedGraph, the zedGraphControl.Refresh() method enables you to refresh the graph pane.
Related
Before Zoom graph
After Zoom in graph
I made some Polyobj on zedgraph but whenever I zoom in graph, these polyobj pop up from it's graph frame. I want these polyobj that gone out of xaxis will disappear when resize xaxis(zoom)
I searched some code, there is "ZOrder = ZedGraph.ZOrder.E_BehindCurves" like these...
but it didnt work any things. I added every order option from A_ to H_behindall
please give me any hint about this situation.
I'm working on a LineGraph control which consists many DependencyProperties that affect how the control should display its data. For example, the control contains the following properties to affect its axes:
AxisStroke - Color of the axes.
AxisThickness - Stroke thickness of the axes.
It also contains properties for display numbers & tick marks
VerticalTicks - True/False to indicate whether or not ticks appear along the vertical axis
HorizontalTicks - True/False to indicate whether or not ticks appear along the horizontal axis
VerticalMin - Minimum value on the vertical axis (numeric)
VerticalStep - The distance in between each vertical tick
VerticalMax - Maximum value on the vertical axis (numeric)
HorizontalMin - Minimum value on the horizontal axis (numeric)
HorizontalStep - The distance in between each horizontal tick
HorizontalMax - Maximum value on the horizontal axis (numeric)
And many more properties exist to allow for different line styles on a single graph (LineColor, LineThickness, DataPointShape, and DataPointIcon to name a few).
My goal is to be able to call out my LineGraph in XAML to insert it into a Window. I would like to be able to specify each of these settings inside the XAML as well, and see the new rendered image of the control in the WPF designer.
Now, given there is a lot of geometric shapes to render on the LineGraph, I though using a Canvas would be a good choice to render the data. Unfortunately, when I'm working in XAML, I cannot perform computations for the locations of shapes based on the control's width & height.
And yes, the shapes' locations must be computed because the data points for the graph are dynamic and the tick-related information is dynamic. Not to mention, I would like to display the actual values along each axis of the LineGraph.
So, I thought I might be able to display this control as if I was doing the rendering in C# code. Other windowing frameworks sometimes provide a Render method that can be used for laying out all of the sub-components.
Doing this, however, doesn't seem possible since WPF relies heavily on XAML for the visual appearance of controls. Also, requiring that the WPF designer must display the LineGraph based on the properties and data specified, it doesn't seem like C# code would solve the problem.
I suppose my questions are these:
How can I render data dynamically inside of a WPF control?
Am I able to specify in C# how my control is rendered, allowing the WPF designer to reflect it?
Side Note:
I've done quite a bit of research, but I am only finding information on how to implement more simple types of controls. If you know of any references that contain information on this topic, please feel free to post them in addition to your answers. I will be more than happy to learn how to do this completely.
EDIT:
I've created a graph using Excel to elaborate what the LineGraph control might look like if it has correct data and properties.
I will answer this based on my experience on implementing custom built graphing libraries in WIN32, WinForm, WPF, WinCE, WP8+WinRT, ....and even on a FPGA :)
It's extremely difficult to implement one from scratch. It may seem easy at first but you will run into a lot of "What should I do if this happens?". For example, in your above graph it seems you got a DataPoint # (5,100) it graphs it pretty well. But lets say, I add another DataPoint # (5.000000005, 0). How would you handle that in your code? Would you say that each pixel on the graph represents an exact value on the X-Axis, or does each pixel represent a range of X-Values?
I would recommend that you use an already establish library to do what you want to do unless you need something very specific like lets say you need horizontal cursors on the graph (think Tektronix Oscilloscope) and you need to calculate some values in between the two cursors.. then maybe you need to implement your own custom one or build on top of an open source one.
So, if you are still adamant of creating your own custom control here are answers to your questions.
How can I render data dynamically inside of a WPF control?
You can use a WriteableBitmap and create your own primitive drawing library from that. After you're done rendering, set it as the ImageSource of your control.
Or you can use WriteableBitmapEx which has GDI like drawing functions already implemented for you.
WriteableBitmapEx CodePlex Page, I also think you can just get it from NuGet as well.
You can also use a <Canvas> and add UI elements to that as well.
Am I able to specify in C# how my control is rendered, allowing the WPF designer to reflect it?
This depends on how you create your controls, but yes you can create Properties in your custom control that will appear in the Designer. Allowing you to change it thus updating the display. I would read a lot of tutorials about writing your own custom user control library. They can explain it better than I can in a SO answer. If you implement the properties correctly it should like so.....
Full Size Image: http://i.stack.imgur.com/pmevo.png
After changing the Number of Rows from 15 to 10 and the starting Y offset to -1 (thus moving the graph up and making the rows a lot taller)
Full Size Image: http://i.stack.imgur.com/0RKnA.png
I have a c# form which is to allow the user to specify a differential equation (dy/dt = -lambda*y) to solve both exactly and approximately (by entering desired values of the intital condition, time step and lambda into textBoxes). Clicking a button calculates the solutions and displays them numerically in boxes as they change over time (using a timer). When the timer finishes, 'Simulation Completed' is displayed in a MessageBox.
At this point, clicking the 'draw graph' button invokes zedGraph to graph the exact and approximate solutions. There are no problems wih calculating and graphing the solutions. The problem is that the label and textBox for timeStep (which I added after adding the zedGraph section) and the 'draw graph' button are superimposed on the graph, partially obscuring it. The textBoxes and labels for lambda and the initial condition were added to the program before the zedGraph part and don't get superimposed.
Is there a way to stop the timeStep label and textBox from being superimposed without having to write the program again, adding the textBox before the zedGraph section?
To summarise: the order in which you add things (at least the way I've done it, if not in general) determines wha happens: adding a textBox before adding the zedGraph section means it doesn't get superimposed on the graph. Add a textBox after adding the zedGraph section and it does get superimposed on the graph. I'm looking for a way o be able to add extra features, having already added the zedGraph section, without them being superimposed on the graph.
You can view 3 screenshots, 2 from before the problem was solved and 1 after here:
https://www.facebook.com/photo.php?fbid=10201376481749572&set=a.10201375193157358.1073741826.1099868090&type=3&theaterset=a.10201375193157358.1073741826.1099868090&type=3&theater
This is a screenshot of the problem:
I just worked out the answer (thanks to God): I just hide the objects I don't want to appear on the graph using the Hide() method at the start of my createGraph() method as follows:
private void CreateGraph(ZedGraphControl zgc)
{
textBox3.Hide();
textBox4.Hide();
label3.Hide();
label5.Hide();
button2.Hide();
Thanks everyone for your input. Quite easy in the end, thankfully... what a relief.
Here's a link to the finished graph:
https://www.facebook.com/photo.php?fbid=10201375420003029&set=a.10201375193157358.1073741826.1099868090&type=3&theater
I am drawing a bar chart and I saw some of them have different width than others.
I tried changing PointWidth and PixelPointWidth properties. But of no use. Here is the graph I got :
The only configure I done is barChart1.Series["DeltaE"]["PointWidth"] = (0.6).ToString();
You may have too many data and the chart is too small. Try delete some data or make the chart bigger.
I made an example. I created a c# project, put a chart in the form, randomly add some data and run the program.
When the chart is big enough, it looks well.
When the chart is smaller, not all the columns are the same width.
I was perusing the asp.net chart control's sample website, and came across something in the pie chart gallery. There was 3 pie charts, "stair stepped" on top of each other. I starting using this control for a financial services application, and would like to replicate this effect. It looks like this:
3d Stair stepped Pie Chart http://www.freeimagehosting.net/uploads/87a5caabca.png
I'd post some code on what I've accomplished so far, but I have no idea where to start with this. I'm guessing maybe I'd have to create the 3 charts, and offset their axes, am I off base here? Any help would be appreciated.
You need to create 3 seperate series and assign them to seperate chart areas.
The chart areas need to stepped down the page using position.x and position.y
Other tricks include disabling the legend for the second and subsequent series.
To get the transparency affect you need to work at a data point level in the series. Note the Ownership data point is not transparent but the renting and leasing data points are.