ZedGraph: just the dots - c#

I am new to ZedGraph. So far I could draw curves and bars. How can I display just the dots without connecting them?
I am using C# and Windows Forms.

The Scatter Plot Demo from ZedGraph's site shows how to do it. There is an IsVisible property on the Line which you set to false to only show the points.
LineItem myCurve = myPane.AddCurve("Title", list, Color.Black, SymbolType.Diamond);
myCurve.Line.IsVisible = false;

I think your solution is on The Code Project. Have a look at the part where he talks about "The Fill class". There is a dot-only example.

Related

Repositioning chart point label

I have a Chart control that contains multiple overlapping Line series like this:
As you can see, the labels of the intersection points of the lines overlap the lines themselves. I tried using the following to no avail:
intersectPoints.SmartLabelStyle.Enabled = true;
intersectPoints.SmartLabelStyle.IsMarkerOverlappingAllowed = false;
I'm pretty sure this is because MarkerOverlapping only applies to Markers in the series the label belongs to.
I'm looking for how to accomplish any one of several solutions:
1) Manually adjust x-y position of Point label
2) Increase opacity of label so that it appears "above" overlapping lines
3) Use some other SmartLabelStyle tool.
4) If no other solution is available, possibly overwriting the draw method for the chart?

Teechart Linear Gauge Duplication of axis title for multiple gauges on single chart

I am evaluating Teechart.Net (v4.13.12.13) for Xamarin Android (v4.12) to determine suitability for a project that requires the use of gauges to present data and I've come across a few issues that I haven't been able to figure out:
I would like to add a number of linear gauges to a chart, each with a unique title, but it seems the axis title assigned to the last gauge that was added to the chart is applied to all gauges in the chart. Am I setting the wrong property (LinearGauge.Axis.Title.Text) or is there some other way to assign unique titles to the linear gauges. The other apparent option would be to add a separate chart for each gauge, but that doesn't seem right. In the image below, I need to show two distinct temperatures but both are labelled the same.
I created a circular gauge and enabled the embedded numeric gauge. However, no matter what I try I cannot get any text displayed in the numeric gauge. It is drawn inside the gauge, but no text. I've set CircularGauge.NumericGauge.Chart.AutoRepaint to true, then false and manually repainted, all without success. Is this a bug? I tried the same code with Teechart.Net for Winforms and it works OK so I'm having doubts about the Teechart release for Xamarin.
Any help will be greatly appreciated.
I would like to add a number of linear gauges to a chart, each with a
unique title, but it seems the axis title assigned to the last gauge
that was added to the chart is applied to all gauges in the chart. Am
I setting the wrong property (LinearGauge.Axis.Title.Text) or is there
some other way to assign unique titles to the linear gauges. The other
apparent option would be to add a separate chart for each gauge, but
that doesn't seem right. In the image below, I need to show two
distinct temperatures but both are labelled the same.
This is by design. Gauges use standard chart axes (left and bottom). Each chart has one set of axes and hence the title is being overwritten. Adding separate charts would be the recommendation.
I created a circular gauge and enabled the embedded numeric gauge.
However, no matter what I try I cannot get any text displayed in the
numeric gauge. It is drawn inside the gauge, but no text. I've set
CircularGauge.NumericGauge.Chart.AutoRepaint to true, then false and
manually repainted, all without success. Is this a bug? I tried the
same code with Teechart.Net for Winforms and it works OK so I'm having
doubts about the Teechart release for Xamarin.
Using the code below doesn't plot text in the NumericGauge in WinForms either. Can you please modify it so that we can reproduce the problem here?
CircularGauge circularGauge1 = new CircularGauge(tChart1.Chart);
circularGauge1.NumericGauge.Visible = true;
Thanks in advance.

Draw custom marker on WPF Toolkit Chart

I have simple (x,y) graph using WPF Toolkit DataVisualisation Chart.
This is Area chart but could be line or box.
I need to show on the chart - which data point was updated last. I'd like to draw a line or show a thick gridline for that data point.
What can be done to achieve it?
I had to change code in the toolkit classes. after 4 hours of getting throught the khaos of the inheritance I finally made by adding some code into : OrientedAxisGridLines (to draw the line), LinearAxis (to calculate pixel position for the line), DataPointSeriesWithAxes (to have dep prop to bind to the user data).
The code is awkward and is written to get job done so I am not sharing it.
If there will be those who wants to see it - leave the comment I might do it later...

Set Zedgraph line width of existing line

Is it possible to set width of existing Zedgraph line? Most examples I saw demonstrate following method:
LineItem myCurve1 = myPane.AddCurve("Sine Wave", spl1, Color.Blue, SymbolType.None);
myCurve1.Line.Width = 3.0F;
But as I see it can be done only at moment of adding new curve. Most obvious solution is to create List and add all curves there to access them later. I wonder is it right way or I am at wrong track?
UPDATE
My situation is following. I have several line curves and list of them in listBox. I want to make currently selected curve bold. That is why I need access to existing curves.
LineItem has constructors that support setting the line width, so you can create the curve first and then add it to your GraphPane, like this:
LineItem myCurve1 =
new LineItem("Sine Wave", spl1, Color.Blue, SymbolType.None, 3.0f);
myPane.CurveList.Add(myCurve1);
Which approach to recommend is more a matter of taste, I think, but personally I prefer to initialize my object as much as possible before adding it to any collection.
UPDATE If you later on would like to access your specific curve item, simply retrieve it from myPane.CurveList. The objects in CurveList are CurveItem:s, so you may need to cast to LineItem to modify line specific properties.
example
((LineItem)zedGraphControl1.GraphPane.CurveList[1]).Line.Width = 3.0F;
Pane in ZedGraph already have list of curves. Maybe you need redraw your pane after changing curves?

Can't clear Silverlight Charting toolkit axes by code

I am attempting to have a Silverlight chart (windows phone 7) that a user can modify by changing some settings.
Upon clearing the charts axes and readding new axes, i end up with double axes being being reported by chart.ActualAxes.Count
does anyone know how to fully clear and delete all the axes on a silverlight chart and add new ones? Am i meant to call something to update the ActualAxes list after adding?
thanks in advance
code sample (call this twice and your chart will end up with 4 axes instead of two):
chart.Axes.Clear();
chart.Axes.Add(new LinearAxis()
{
Orientation = AxisOrientation.Y,
Location = AxisLocation.Left,
Minimum = 0
});
chart.Axes.Add(new DateTimeAxis()
{
Orientation = AxisOrientation.X,
Location = AxisLocation.Bottom,
IntervalType = DateTimeIntervalType.Days
});
The Chart Axes collection represents the persistentAxes in the chart that will be rendered even if there are no series in the chart. The ActualAxes represents a combination of both the persistent Axes and those in use by the series in the chart.
When you Clear the collection and test ActualAxes.Count you will find it still says 2 even though Axes is now 0. The ActualAxes (an instance of SeriesHostAxesCollection) will not allow the removal of an axis which is in use be an existing Series. Hence the ActualAxes collection holds on to the originals. You then add 2 others to the persistent Axes collection so those 2 new ones are also added to the ActualAxes, you end up with 4.
Run your code yet again (a third time) and you should see the ActualAxes count remains 4. Thats because the 2 Axis you added in the second call are not being used by any series so they can be removed from the ActualAxes collection.
Following code should work
var xAxis = chart_name.ActualAxes.OfType<LinearAxis>().FirstOrDefault(ax => ax.Orientation == AxisOrientation.X);
if (xAxis != null)
{
xAxis.Title = "The Title";
}

Categories

Resources