Click here to Skip to main content
15,895,656 members
Home / Discussions / C#
   

C#

 
JokeRe: HELP, what're the errors!!! ERROR - unsafe Pin
Thomas Krojer12-Dec-10 23:08
Thomas Krojer12-Dec-10 23:08 
AnswerRepost Pin
Not Active12-Dec-10 15:25
mentorNot Active12-Dec-10 15:25 
GeneralRe: Repost Pin
Luc Pattyn12-Dec-10 15:27
sitebuilderLuc Pattyn12-Dec-10 15:27 
GeneralRe: Repost Pin
Not Active12-Dec-10 15:34
mentorNot Active12-Dec-10 15:34 
QuestionVisual Studio and Multithreaded debugging Pin
Super Lloyd12-Dec-10 13:59
Super Lloyd12-Dec-10 13:59 
AnswerRe: Visual Studio and Multithreaded debugging Pin
Not Active12-Dec-10 15:12
mentorNot Active12-Dec-10 15:12 
GeneralRe: Visual Studio and Multithreaded debugging Pin
Super Lloyd12-Dec-10 15:20
Super Lloyd12-Dec-10 15:20 
QuestionQuestion about using Zedgraph [modified] Pin
Rafone12-Dec-10 3:51
Rafone12-Dec-10 3:51 
If this isn't the right place for this question please let me know.
I was playing with one of the samples Multi Y Graph. I added a couple of varibles and execute it 4 different times via mouse click.
The first time through all works as expected. The second time through the x and y axis work correctly but the 3rd and 4th do not.
Can anyone point me in the right direction.
Here is the code I am using...
public partial class Form1 : Form
    {
        private static int clickCount = 0;
        //
        private LineItem myCurve;
        //
        public Form1()
        {
            InitializeComponent();
        }

        #region Graph Test

        // Call this method from the Form_Load method, passing your ZedGraphControl instance
        public void CreateChart(ZedGraphControl zgc)
        {

            // Get a reference to the GraphPane
            GraphPane myPane = zgc.GraphPane;

            // Set the titles and axis labels
            myPane.Title.Text = "Demonstration of Multi Y Graph";
            myPane.XAxis.Title.Text = "Time, s";
            myPane.YAxis.Title.Text = "Velocity, m/s";
            myPane.Y2Axis.Title.Text = "Acceleration, m/s2";

            // Make up some data points based on the Sine function
            PointPairList vList = new PointPairList();
            PointPairList aList = new PointPairList();
            PointPairList dList = new PointPairList();
            PointPairList eList = new PointPairList();

            // Fabricate some data values
            for (int i = 0; i < 30; i++)
            {
                double time = (double)i;
                double acceleration = 2.0;
                double velocity = acceleration * time;
                double distance = acceleration * time * time / 2.0;
                double energy = 100.0 * velocity * velocity / 2.0;
                aList.Add(time, acceleration);
                vList.Add(time, velocity);
                eList.Add(time, energy);
                dList.Add(time, distance);
            }
            if (clickCount == 1)
            {
                // Generate a red curve with diamond symbols, and "Velocity" in the legend
                LineItem myCurve = myPane.AddCurve("Velocity",
                   vList, Color.Red, SymbolType.Diamond);
                // Fill the symbols with white
                myCurve.Symbol.Fill = new Fill(Color.White);
                //
                // Make the Y axis scale red
                myPane.YAxis.Scale.FontSpec.FontColor = Color.Red;
                myPane.YAxis.Title.FontSpec.FontColor = Color.Red;
                // turn off the opposite tics so the Y tics don't show up on the Y2 axis
                myPane.YAxis.MajorTic.IsOpposite = false;
                myPane.YAxis.MinorTic.IsOpposite = false;
                // Don't display the Y zero line
                myPane.YAxis.MajorGrid.IsZeroLine = false;
                // Align the Y axis labels so they are flush to the axis
                myPane.YAxis.Scale.Align = AlignP.Inside;
                myPane.YAxis.Scale.Max = 100;
            }
            if (clickCount == 2)
            {
                // Generate a blue curve with circle symbols, and "Acceleration" in the legend
                myCurve = myPane.AddCurve("Acceleration",
                   aList, Color.Blue, SymbolType.Circle);
                // Fill the symbols with white
                myCurve.Symbol.Fill = new Fill(Color.White);
                // Associate this curve with the Y2 axis
                myCurve.IsY2Axis = true;
                //
                // Enable the Y2 axis display
                myPane.Y2Axis.IsVisible = true;
                // Make the Y2 axis scale blue
                myPane.Y2Axis.Scale.FontSpec.FontColor = Color.Blue;
                myPane.Y2Axis.Title.FontSpec.FontColor = Color.Blue;
                // turn off the opposite tics so the Y2 tics don't show up on the Y axis
                myPane.Y2Axis.MajorTic.IsOpposite = false;
                myPane.Y2Axis.MinorTic.IsOpposite = false;
                // Display the Y2 axis grid lines
                myPane.Y2Axis.MajorGrid.IsVisible = true;
                // Align the Y2 axis labels so they are flush to the axis
                myPane.Y2Axis.Scale.Align = AlignP.Inside;
                myPane.Y2Axis.Scale.Min = 1.5;
                myPane.Y2Axis.Scale.Max = 3;
            }
            if (clickCount == 3)
            {
                // Generate a green curve with square symbols, and "Distance" in the legend
                myCurve = myPane.AddCurve("Distance",
                   dList, Color.Green, SymbolType.Square);
                // Fill the symbols with white
                myCurve.Symbol.Fill = new Fill(Color.White);
                // Associate this curve with the second Y axis
                myCurve.YAxisIndex = 1;
                //
                // Create a second Y Axis, green
                YAxis yAxis3 = new YAxis("Distance, m");
                myPane.YAxisList.Add(yAxis3);
                yAxis3.Scale.FontSpec.FontColor = Color.Green;
                yAxis3.Title.FontSpec.FontColor = Color.Green;
                yAxis3.Color = Color.Green;
                // turn off the opposite tics so the Y2 tics don't show up on the Y axis
                yAxis3.MajorTic.IsInside = false;
                yAxis3.MinorTic.IsInside = false;
                yAxis3.MajorTic.IsOpposite = false;
                yAxis3.MinorTic.IsOpposite = false;
                // Align the Y2 axis labels so they are flush to the axis
                yAxis3.Scale.Align = AlignP.Inside;
            }
            if (clickCount == 4)
            {
                // Generate a Black curve with triangle symbols, and "Energy" in the legend
                myCurve = myPane.AddCurve("Energy",
                   eList, Color.Black, SymbolType.Triangle);
                // Fill the symbols with white
                myCurve.Symbol.Fill = new Fill(Color.White);
                // Associate this curve with the Y2 axis
                myCurve.IsY2Axis = true;
                // Associate this curve with the second Y2 axis
                myCurve.YAxisIndex = 1;
                //
                Y2Axis yAxis4 = new Y2Axis("Energy");
                yAxis4.IsVisible = true;
                myPane.Y2AxisList.Add(yAxis4);
                // turn off the opposite tics so the Y2 tics don't show up on the Y axis
                yAxis4.MajorTic.IsInside = false;
                yAxis4.MinorTic.IsInside = false;
                yAxis4.MajorTic.IsOpposite = false;
                yAxis4.MinorTic.IsOpposite = false;
                // Align the Y2 axis labels so they are flush to the axis
                yAxis4.Scale.Align = AlignP.Inside;
                yAxis4.Type = AxisType.Log;
                yAxis4.Scale.Min = 100;
            }
            // Show the x axis grid
            myPane.XAxis.MajorGrid.IsVisible = true;

            // Fill the axis background with a gradient
            myPane.Chart.Fill = new Fill(Color.White, Color.LightGoldenrodYellow, 45.0f);

            zgc.AxisChange();
            zgc.Invalidate();

        }

        #endregion

        private void toolStripButton1_Click(object sender, EventArgs e)
        {

            if (clickCount > 4 || clickCount == 4)
            {
                clickCount = 1;
            }
            else
            {
                clickCount = clickCount + 1;
            }
            CreateChart(zgc);

        }
    }



thanks in advance
rafone

Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...


-- Modified Sunday, December 12, 2010 12:28 PM

AnswerRe: Question about using Zedgraph Pin
Not Active12-Dec-10 5:17
mentorNot Active12-Dec-10 5:17 
GeneralRe: Question about using Zedgraph Pin
Rafone12-Dec-10 6:32
Rafone12-Dec-10 6:32 
GeneralRe: Question about using Zedgraph Pin
Thomas Krojer30-Dec-10 3:44
Thomas Krojer30-Dec-10 3:44 
GeneralRe: Question about using Zedgraph Pin
Rafone30-Dec-10 5:16
Rafone30-Dec-10 5:16 
AnswerRe: Question about using Zedgraph Pin
Thomas Krojer12-Dec-10 23:42
Thomas Krojer12-Dec-10 23:42 
GeneralRe: Question about using Zedgraph Pin
Rafone13-Dec-10 3:45
Rafone13-Dec-10 3:45 
GeneralRe: Question about using Zedgraph Pin
Thomas Krojer13-Dec-10 3:59
Thomas Krojer13-Dec-10 3:59 
Questionwhy not responding? Pin
Jassim Rahma12-Dec-10 2:48
Jassim Rahma12-Dec-10 2:48 
AnswerRe: why not responding? Pin
Luc Pattyn12-Dec-10 3:04
sitebuilderLuc Pattyn12-Dec-10 3:04 
AnswerRe: why not responding? PinPopular
Not Active12-Dec-10 3:43
mentorNot Active12-Dec-10 3:43 
GeneralRe: why not responding? Pin
Luc Pattyn12-Dec-10 5:46
sitebuilderLuc Pattyn12-Dec-10 5:46 
GeneralRe: why not responding? Pin
Jassim Rahma13-Dec-10 2:49
Jassim Rahma13-Dec-10 2:49 
GeneralRe: why not responding? Pin
Not Active13-Dec-10 3:28
mentorNot Active13-Dec-10 3:28 
QuestionHow can I filter certain messages in log4net Pin
Berlus11-Dec-10 23:54
Berlus11-Dec-10 23:54 
AnswerRe: How can I filter certain messages in log4net Pin
fjdiewornncalwe12-Dec-10 3:50
professionalfjdiewornncalwe12-Dec-10 3:50 
AnswerRe: How can I filter certain messages in log4net Pin
Manfred Rudolf Bihy12-Dec-10 4:39
professionalManfred Rudolf Bihy12-Dec-10 4:39 
GeneralRe: How can I filter certain messages in log4net Pin
Berlus12-Dec-10 11:04
Berlus12-Dec-10 11:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.