Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello, I've been away from .Net developping for like 6 years, coming back and I had to create a chart, I was really pleased to see this control, but the way it works is kinda annoying, anyway, look at this picture :

[ATTACH]5759._xfImport[/ATTACH]

These are two charts, both the same one, the only difference is their width and height, but as you can see, on the smaller on, the labels are unaligned.

At first I had the same problem with the bigger one, but increasing the distance between the from and to points when including the customlabel fixed it, however the same trick doesn't seem to be working for the smaller one.

 

The points are added this way (these are random points added directly for now, it'll become automated in the future)

           serie1.Points.AddXY(1, 2000);
           area.AxisX.CustomLabels.Add(0.5, 1.5, "1");
           serie1.Points.AddXY(2, 20000);
           serie1.Points.AddXY(3, 30000);
           serie1.Points.AddXY(4, 40000);
           serie1.Points.AddXY(5, 60000);
           serie1.Points.AddXY(6, 55000);
           serie1.Points.AddXY(7, 59000);
           serie1.Points.AddXY(8, 70000);
           serie1.Points.AddXY(9, 90000);
           serie1.Points.AddXY(10, 80000);
           area.AxisX.CustomLabels.Add(9, 11, "10");
           serie1.Points.AddXY(11, 100000);
           serie1.Points.AddXY(12, 95000);
           serie1.Points.AddXY(13, 80000);
           serie1.Points.AddXY(14, 75000);
           serie1.Points.AddXY(15, 89000);
           serie1.Points.AddXY(16, 110000);
           serie1.Points.AddXY(17, 105000);
           serie1.Points.AddXY(18, 115000);
           serie1.Points.AddXY(19, 120000);
           serie1.Points.AddXY(20, 130000);
           area.AxisX.CustomLabels.Add(19, 21, "20");
           serie1.Points.AddXY(21, 115000);
           serie1.Points.AddXY(22, 110000);
           serie1.Points.AddXY(23, 120000);
           serie1.Points.AddXY(24, 125000);
           serie1.Points.AddXY(25, 124000);
           serie1.Points.AddXY(26, 135000);
           serie1.Points.AddXY(27, 140000);
           serie1.Points.AddXY(28, 155000);
           area.AxisX.CustomLabels.Add(27, 29, "28");

 

serie1 is the blue line, area is the ChartArea.

Anyone knows how I could make sure that the labels stay on the same row?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...