Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 877429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:36:28+00:00 2026-05-15T11:36:28+00:00

i am trying ZedGraph in windows form. i imported the dll and it shows

  • 0

i am trying ZedGraph in windows form. i imported the dll and it shows in UI designer successfully. when i compile and run the program. it pops up the zedgrah grilled view, but no points on it. could anyone help me see what was wrong?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZedGraph;

namespace WindowsFormsApplication1
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void zedGraphControl1_Load(object sender, EventArgs e)
        {
            CreateChart(zedGraphControl1);
        }
        public void CreateChart(ZedGraphControl zgc)
        {
            GraphPane myPane = zgc.GraphPane;

            // Set the title and axis labels
            myPane.Title.Text = "Line Graph with Band Demo";
            myPane.XAxis.Title.Text = "Sequence";
            myPane.YAxis.Title.Text = "Temperature, C";

            // Enter some random data values
            double[] y = { 100, 115, 75, 22, 98, 40, 10 };
            double[] y2 = { 90, 100, 95, 35, 80, 35, 35 };
            double[] y3 = { 80, 110, 65, 15, 54, 67, 18 };
            double[] x = { 100, 200, 300, 400, 500, 600, 700 };

            // Fill the axis background with a color gradient
            myPane.Chart.Fill = new Fill(Color.FromArgb(255, 255, 245), Color.FromArgb(255, 255, 190), 90F);

            // Generate a red curve with "Curve 1" in the legend
            LineItem myCurve = myPane.AddCurve("Curve 1", x, y, Color.Red);
            // Make the symbols opaque by filling them with white
            myCurve.Symbol.Fill = new Fill(Color.White);

            // Generate a blue curve with "Curve 2" in the legend
            myCurve = myPane.AddCurve("Curve 2", x, y2, Color.Blue);
            // Make the symbols opaque by filling them with white
            myCurve.Symbol.Fill = new Fill(Color.White);

            // Generate a green curve with "Curve 3" in the legend
            myCurve = myPane.AddCurve("Curve 3", x, y3, Color.Green);
            // Make the symbols opaque by filling them with white
            myCurve.Symbol.Fill = new Fill(Color.White);

            // Manually set the x axis range
            myPane.XAxis.Scale.Min = 0;
            myPane.XAxis.Scale.Max = 800;
            // Display the Y axis grid lines
            myPane.YAxis.MajorGrid.IsVisible = true;
            myPane.YAxis.MinorGrid.IsVisible = true;

            // Draw a box item to highlight a value range
            BoxObj box = new BoxObj(0, 100, 1, 30, Color.Empty,
                    Color.FromArgb(150, Color.LightGreen));
            box.Fill = new Fill(Color.White, Color.FromArgb(200, Color.LightGreen), 45.0F);
            // Use the BehindAxis zorder to draw the highlight beneath the grid lines
            box.ZOrder = ZOrder.E_BehindCurves;
            // Make sure that the boxObj does not extend outside the chart rect if the chart is zoomed
            box.IsClippedToChartRect = true;
            // Use a hybrid coordinate system so the X axis always covers the full x range
            // from chart fraction 0.0 to 1.0
            box.Location.CoordinateFrame = CoordType.XChartFractionYScale;
            myPane.GraphObjList.Add(box);

            // Add a text item to label the highlighted range
            TextObj text = new TextObj("Optimal\nRange", 0.95f, 85, CoordType.AxisXYScale,
                                    AlignH.Right, AlignV.Center);
            text.FontSpec.Fill.IsVisible = false;
            text.FontSpec.Border.IsVisible = false;
            text.FontSpec.IsBold = true;
            text.FontSpec.IsItalic = true;
            text.Location.CoordinateFrame = CoordType.XChartFractionYScale;
            text.IsClippedToChartRect = true;
            myPane.GraphObjList.Add(text);

            // Fill the pane background with a gradient
            myPane.Fill = new Fill(Color.WhiteSmoke, Color.Lavender, 0F);

            // Calculate the Axis Scale Ranges
            zgc.AxisChange();
        }

    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:36:28+00:00Added an answer on May 15, 2026 at 11:36 am

    Try moving the CreateChart method call somewhere else (for example Form_Load instead of zedGraphControl1_Load)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to remove a specific graph object from the zedgraph, is it possible....?
Trying to create a GPA Calculator. I have a form that submits to a
Trying to load a custom form submisson error box in Facebox, when testing around
Trying to remove loading animations when individual images have finished loading but have run
Trying to use WMI to obtain a list of installed programs for Windows XP.
I am trying to create a histogram with ZedGraph. The bars and data are
Trying to install rattle on a windows server 2008 R2 64bit machine, using 64-bit
Trying to post a simple form to my database but can't get it to
Trying to build out an exception if move.UserId does not equal currentUserId then Redirect
Trying to make this jQuery filter that uses .find case-insensitive. For example, when the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.