Connecting datapoints seperated by empty points in a win form chart - winforms

I have two series to be plotted as a line chart with Win Form Charts. The first series has x,y values of
{(datetime1:4),(datetime2:4),(datetime3:4),(datetime4:1),(datetime5:3)}
And the second series has x,y values of
{(datetime1:4),(datetime3:14),(datetime5:6)}
Since the second series has datetime2 and datetime4 missing, I have added DbNull.Value as value for these points. So now the second series will be
{(datetime1:4),(datetime2:DbNull.Value),(datetime3:14),(datetime4:DbNull.Value),(datetime5:6)}
Because of this the second series shows only dots. Could you please suggest me how can I connect these empty points with the average of the two closest data points.

The way to acheive this is
mySeries.EmptyPointStyle.BorderDashStyle = ChartDashStyle.Dash; // select the style you want
mySeries.EmptyPointStyle.Color = Color.Gray; // setting the color might be required
mySeries["EmptyPointValue"] = "Average";

Related

ShieldUI Stacked Bar Graph with Totals

I've got a stacked bar graph that shows two categories of information. Now I have a requirement to show the total of the bars at the end of the bar. I've attached a mock-up showing what I'm trying to do -- the numbers in red are what I'm trying to add.
(source: michaelandlisa.us)
I couldn't find anything in the documentation on how to add totals, or on how to add annotations (which would also work).
Basically, ShieldUI jQuery chart plugin renders the series without text, as shown here.
To alter this behavior, you need to first enable the text.
Then, you can use a format function to either show some cumulative text, or return an empty string. More information on this approach is available here.
This can be coupled with a global counter to determine each Xth iteration.
I managed to get this to work by adding a Scatter chart of total values on top of the existing bar chart.
http://michaelandlisa.us/Images/Forums/stacked_with_totals_scatter.png
I also set the color on the series to "transparent" so the point wouldn't show up, and then I bumped the X and Y by 15 and 12 respectively. I also set the style to Bold, and set the format to "{point.y:n0}". Here's the relevant MVC code (where totals is a List of object):
.DataSeries(series => series.Scatter()
.Data(totals)
.CollectionAlias("Total")
.Color("transparent")
.AddToLegend(false).DataPointText(dtp =>
{
dtp.Enabled(true);
dtp.Format("{point.y:n0}");
dtp.Style(s => s.FontWeight(FontWeight.Bold));
dtp.Color("red");
dtp.X(15);
dtp.Y(12);
}))

Oxyplot with WPF

I am working with and I oxyplot download an example the following link:
http://blog.bartdemeyer.be/2013/03/creating-graphs-in-wpf-using-oxyplot/
I added my own data plotting to go, but the incoming points are accumulated and that makes the graph becomes unreadable.
how I do like to go update the chart so that the old points are eliminated and new points are displayed normally and not stacked.
http://blog.bartdemeyer.be/wp-content/uploads/image_thumb19.png
You need to zoom it. This thread from oxyplot disscusion will help you.
http://oxyplot.codeplex.com/discussions/402272
Use LineSeries.Points.RemoveAt(index)
Example:
(DataPlot.Series[0] as LineSeries).Points.Add(new DataPoint(xValue, yValue0));
(DataPlot.Series[1] as LineSeries).Points.Add(new DataPoint(xValue, yValue1));
if (valueRange > 10000) //points will accumulate until the x-axis reaches 10000
{ //after 10000
(DataPlot.Series[0] as LineSeries).Points.RemoveAt(0); //removes first point of first series
(DataPlot.Series[1] as LineSeries).Points.RemoveAt(0); //removes first point of second series
}
But you must use it together - adding one new point and removing one. Then the points will not accumulate and you will have x-axis of range you wish.

How to create multiple vertical lines jfreechart

I want to create verical lines , the thing is , for example i have a space between x=0 and x=20 , and i have a jtextfield where the user can digit a number , and that number will create the same number of vertical lines in that space of x=0 and x=20. i'm using xyplot , and the problem is , if i use the same series to add the points i will get a zigzag line , for exemple if i do:
series.add(0,-2)
series.add(0,2)
series.add(4,-2)
series.add(4,2)
So for differents coordenate xx i have to have a different seried . But if i do a different series i have to do a diferente dataset too, because when i try to add different series to the same dataset i get a error. i thought about using a for loop to create differents dataset and differents series , but i have no ideia how can i do that . i could use the grid line to do this , but i only want to see the lines between x=0 and x=20 , and i don't know if i can do that with the grid line , and i don't know how to change the space between grid lines .
So maybe you can tell me so ideias about this , and if you could guide me , that would be great.
There is a facility in JFreeChart to add "markers" to a plot to mark particular values along an axis. The markers are typically drawn as lines across the plot, perpendicular to the x-axis (domain markers) or the y-axis (range markers). In your case, it sounds like you want to add a fixed number of domain markers to the plot, so you should call the addDomainMarker() method on the plot.

Displaying an Elevation grid in ParaView

I'm new to ParaView and completely lost with all the different data formats. All I want to do is display an elevation grid which is produced by a program. I store the elevation grid in a two dimensional array of floats which is indexed by x and y coordinates and stores the z coordinate. In other words elevationGrid[x][y] stores the height above the point (x, y).
Which file format should I use for this and how is it defined? It would be ideal if someone could give an example file for, say, a 3x3 grid.
A first approach with a 5x5 grid and equation z = x^2+y^2, using a very simple input format. This is a general approach, not especially dedicated to structured grid.
The following has been done with Paraview 3.14.1.
1) Save your data in csv format, i.e. :
"x","y","z"
-0.5,-0.5,0.5
-0.30000001,-0.5,0.34000001
-0.1,-0.5,0.26
[...]
0.1,0.5,0.26
0.30000001,0.5,0.34000001
0.5,0.5,0.5
2) Open in Paraview your csv file
Fill the required import options.
3) Convert your table to geometrical points
Apply Filters > Alphabetical > Table to points
You will be asked to give each variables for each coordinates.
4) Display 3D view to see your points
Create a new visualization view (add a new tab) and choose "3D View".
Activate your TableToPoints filter clicking on the little eye near its name in the pipeline.
If evething is okay, at this point you will see your scatter plot.
5) Last step: create a surface
Apply Filters > Alphabetical > Delaunay 2D
And using default options, one finally obtains:
EDIT:
I remember the name of the dedicated function to create elevation map... It is the Wrap by scalar function. You can combine it with some above steps to get more easily what you want. I could give you an example if necessary.

JFreeChart selectively render lines

Please see the the xy/timeseries chart I have posted here: http://imagebin.org/151195
How do I selectively render only the horizontal lines, and leave out the lines between the neighboring data points that don't have the same y value? Basically the result would be a series of horizontal lines?
You'll have to scan your data model to find the ordinate where dy/dx < ɛ, for some value of ɛ near zero. Of course, you'll have to scan past the initial flat part, and decide how to deal with a series that never rises above ɛ.
Once you know the desired ordinate, use setLowerBound() on your domain axis.

Resources