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 8359765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:15:09+00:00 2026-06-09T11:15:09+00:00

I have an MS Chart. My code is the following: chart.Series[chartType].Points.DataBindXY(xValues, xCaption, yValues, yCaption);

  • 0

I have an MS Chart.
My code is the following:

chart.Series[chartType].Points.DataBindXY(xValues, xCaption, yValues, yCaption);
chart.ChartAreas[0].AxisX.LabelStyle.Format = "CustomAxisXFormat";
chart.FormatNumber += new EventHandler<FormatNumberEventArgs>(chart_FormatNumber);

Then

private void chart_FormatNumber(object sender, FormatNumberEventArgs e)
{
    if (e.ElementType == ChartElementType.AxisLabels &&
        e.Format == "CustomAxisXFormat")
    {
        e.LocalizedValue = string.Format("{0:hh tt}", new DateTime(1, 1, 2, (int)e.Value, 0, 0).AddHours(-1));
    }
}

xValues and yValues are are arrays of ints.
The problem I am having is, if xValues = int[]{1,2,3}, when chart_FormatNumber handles the event, the values (e.Value) change to {2,3,4}.
So have to do a subtraction there to make it the correct value.
Can somebody tell me what is going on and/or how to stop MSChart from changing my values?

  • 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-09T11:15:11+00:00Added an answer on June 9, 2026 at 11:15 am

    Ok, after some head scratching, I figured out what was happening. I was supplying my x parameters are int. MS chart was adding +1 and -1 to the x axis range. The x values I was providing was xValues = int[]{1,2,3}. In chart_FormatNumber() I was getting {0,1,2,3,4} which was throwing me off.

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

Sidebar

Related Questions

I have the following google chart code that im working with as an example:
I have a following code: [chart removeFromSuperview]; [chart release]; chart = nil; BNPieChart *aChart
I have a following code: NSLog(@%d, [chart retainCount]); self.chart = [[BNPieChart alloc] initWithFrame:self.view.frame]; NSLog(@%d,
I have to following code which displays a chart that represents data over a
I'm prototyping a chart using ASP.NET Chart Controls. I have the following code to
I have the following code: http://jsfiddle.net/maniator/vTjW8/ var createChartTemplate = function() { return { chart:
I have bar chart and the following code for that: var line1=[['0-1',275134],['2-3',261562],['4-5',285681],['6-7',915432],['8-9',555131]]; var line2=[['0-1',353628],['2-3',287898],['4-5',297550],['6-7',103313],['8-9',616089]];
I have the following code: $.ajax({ async: false, url: 'chart_data.php', data: {'option':'high', 'id':id}, dataType:
I have the following code: char stats[109]; /* !LINE UNDER QUESTION! */ sprintf(stats, OBJECTS:\n%u/256\n
gcc 4.4.2 I have the following code: char channels[] = NumberOfChannel = [2]; sscanf(channels,

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.