Sunday, February 7, 2010

Zed Charting Tools


A good free charing tool is Zed Graphing. Here is a screenshot of an implementation of ZedGraph, an update of my NetPinger 2010 app as well.

public void CreateChartMemory()

{

// GraphPane myPane = zgc.GraphPane;

// Set the GraphPane title

zedGraphControl2.GraphPane.Title.Text = lblDomain.Text;

zedGraphControl2.GraphPane.Title.FontSpec.IsItalic = true;

zedGraphControl2.GraphPane.Title.FontSpec.Size = 24f;

zedGraphControl2.GraphPane.Title.FontSpec.Family = "Calibri";

zedGraphControl2.GraphPane.Title.FontSpec.FontColor = Color.White;

// Fill the pane background with a color gradient

zedGraphControl2.GraphPane.Fill = new Fill(Color.SteelBlue,

Color.AliceBlue, 45.0f);

// No fill for the chart background

zedGraphControl2.GraphPane.Chart.Fill.Type = FillType.None;

// Set the legend to an arbitrary location

zedGraphControl2.GraphPane.Legend.Position = LegendPos.Float;

zedGraphControl2.GraphPane.Legend.Location = new Location(0.95f,

0.15f, CoordType.PaneFraction,

AlignH.Right, AlignV.Top);

zedGraphControl2.GraphPane.Legend.FontSpec.FontColor = Color.Black;

zedGraphControl2.GraphPane.Legend.FontSpec.Size = 10f;

zedGraphControl2.GraphPane.Legend.IsHStack = false;

// Add some pie slices

PieItem segment1 = zedGraphControl2.GraphPane.AddPieSlice(

100 - prgMemory.Value, Color.OrangeRed, Color.Black,

45f, 0,100 - prgMemory.Value+ "% Used");

PieItem segment2 = zedGraphControl2.GraphPane.AddPieSlice(

prgMemory.Value, Color.LimeGreen, Color.Black,

45f, .0, prgMemory.Value + "% Free");

segment1.LabelDetail.FontSpec.FontColor = Color.Black;

segment2.LabelDetail.FontSpec.FontColor = Color.Black;

// Sum up the pie values

CurveList curves = zedGraphControl2.GraphPane.CurveList;

double total = 0;

for (int x = 0; x <>

total += ((PieItem)curves[x]).Value;

// Make a text label to highlight the total value

TextObj text = new TextObj("Total Memory:\n" + " " +

total.ToString() + "%",

0.18F, 0.40F, CoordType.PaneFraction);

text.Location.AlignH = AlignH.Center;

text.Location.AlignV = AlignV.Bottom;

text.FontSpec.Border.IsVisible = false;

text.FontSpec.FontColor = Color.White;

text.FontSpec.Fill = new Fill(Color.Black, Color.FromArgb(

255, 100, 100), 45F);

text.FontSpec.StringAlignment = StringAlignment.Center;

zedGraphControl2.GraphPane.GraphObjList.Add(text);

// Create a drop shadow for the total value text item

TextObj text2 = new TextObj(text);

text2.FontSpec.Fill = new Fill(Color.Black);

text2.FontSpec.FontColor = Color.Black;

text2.Location.X += 0.008f;

text2.Location.Y += 0.01f;

zedGraphControl2.GraphPane.GraphObjList.Add(text2);

// Calculate the Axis Scale Ranges

zedGraphControl2.AxisChange();

}

No comments:

Post a Comment

Generating "Always On Top" NSWindow in macOS across all detected displays

Also: Using UIKit & Cocoa Frameworks using Objective-C In m acOS or OS X , written in either Objective-C or Swift  Langues, you m...