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

  • Home
  • SEARCH
  • 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 7980453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:04:54+00:00 2026-06-04T10:04:54+00:00

i m using c# for first time in a asp.net website, in which i

  • 0

i m using c# for first time in a asp.net website, in which i am creating charts.
i have created a column chart- 2D, and the code goes like this,

protected void chrtTickets_Load(object sender, EventArgs e)
        {
            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {

                connection.Open();


                SqlCommand cmmd6 = new SqlCommand("getHowTicketsLoggedChart", connection);
                cmmd6.CommandType = CommandType.StoredProcedure;


                DataSet ds1 = new DataSet();

                SqlDataAdapter dad = new SqlDataAdapter(cmmd6);

                dad.Fill(ds1);

                chrtTickets.DataSource = ds1;


                chrtTickets.Series["Series1"].XValueMember = "MonYYYY";

                chrtTickets.Series["Series1"].YValueMembers = "aa";


                chrtTickets.DataBind();
                connection.Close();


            }
        }

but i have the stored procedure which returns me another field “Description” along with MonYYYy and aa as they are used in xaxis and yaxis.

but according to the “description” field value say: email, phone, portal. i want to assign a different color to each column depending upon each row’s description value, if its Email-> red and so on etc.

can anyone please guide me through this?

what i mean is my data will be be like this: so i will not know what will be color type value in advance, this is the table values returned to me from db by my stored procedure.

color type| y-axiz value | x-axis


Email Connector| 24| Dec 2011
Phone | 32 | Dec 2011
Email Connector |643 | Jan 2012
Internal | 32 | Jan 2012
Phone |455| Jan 2012
Portal |2 | Jan 2012
Sales Order| 2| Jan 2012

it cold be one of the 5 types ex. email, portal but many x-axis value.

datapoints will not be known. they are dynamic.

  • 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-06-04T10:04:56+00:00Added an answer on June 4, 2026 at 10:04 am

    you can try this it should randomly chose a color for the next bar

    Color[] colors = new Color[] { Color.Red, Color.Green, Color.Wheat, Color.Gray. Color.Black,  Color.Blue};
    foreach (Series series in chrtTickets.Series)
    {
        foreach (DataPoint point in series.Points)
        {
            Random random = new Random();
            int randomNumber = random.Next(0, 5);
            point.LabelBackColor = colors[ randomNumber];
        }
    }
    

    here is main article http://forums.asp.net/t/1652369.aspx/1

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

Sidebar

Related Questions

I have an ASP.Net 4.0 website which uses SQL Server CE and EF code-first
first time using Asp.Net MVC here. I have a model class defined with 3
I have a this asp.net page which upon first time load: 1: Make a
I have a website created with ASP.NET and a web service, both using FormsAuthentication
I'm using ASP.NET charts for the first time and am having great success. The
First time using Asp.net-mvc and originally followed the NerdDinner tutorial. My form submit button
This is my first time using AJAX with ASP.NET so please allow m some
I'm using LinqToSql classes in an ASP.NET website and let's say I have an
I've been making my first ASP.NET Visual Studio website and I have just started
I am using asp.net routes for the first time. Here is something I am

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.