Jump to content
Software FX Community

Broken Y Axis


FSzymanski
 Share

Recommended Posts

Is there support in Chart FX 7 for broken Axes?  An example of what I'm talking of can be seen here: http://peltiertech.com/WordPress/broken-y-axis-in-excel-chart/. 

I would like to apply this to a line graph.  My application lets users select among a set of data to graph, and some of the series have points that are in a largely different range than the others.  If they select one series with values in the hundreds of thousands and one that varies between 10 and 20, then the chart will plot from 0 to hundred of thousands and the lower series loses its variance.  The user won't be able to see any change in the lower series that they may consider significant.

~Frank

Link to comment
Share on other sites



I made a sample similar to this for someone else a while
back. Since Chart FX 7 does not support broken Y axis (Chart FX 8 will), we can
do something similar to what was suggested on the link you posted. Have 2
panes, 2 Y axis, and same data on both. Here is the code. Note that you can
modify the panes sizes, proportion and such to make it more visually appealing.





  protected void
Page_Load(object sender, EventArgs e) {



 



 
DataTable table1 = new
DataTable("Test");



 



 
//Create a table with your data twice



 
table1.Columns.Add("Value1",
System.Type.GetType("System.Double"));



 
table1.Columns.Add("Value2",
System.Type.GetType("System.Double"));



 



 
table1.Rows.Add(new object[]
{ 10, 10 });



 
table1.Rows.Add(new object[]
{ 12, 12 });



 
table1.Rows.Add(new object[]
{ 11, 11 });



 
table1.Rows.Add(new object[]
{ 13, 13 });



 
table1.Rows.Add(new object[]
{ 89, 89 });



 
table1.Rows.Add(new object[]
{ 10, 10 });



 



 
Chart1.DataSourceSettings.Fields.Add(new FieldMap("Value1",
FieldUsage.Value));



 
Chart1.DataSourceSettings.Fields.Add(new FieldMap("Value2",
FieldUsage.Value));



 



 
Chart1.DataSource = table1;



 



 
Chart1.Data.Series = 2;



 



 
//Make both series the same color



 
Chart1.Series[1].Color = Chart1.Series[0].Color;



 
Chart1.Series[1].AlternateColor = Chart1.Series[0].AlternateColor;



 



 
Pane pane1 = Chart1.Panes[0];



 
Pane pane2 = new
Pane();



 
Chart1.Panes.Add(pane2);



 
Chart1.Series[0].Pane = Chart1.Panes[0];



 
Chart1.Series[1].Pane = Chart1.Panes[1];



 



 
pane2.AxisY.Max = 15;



 
pane2.AxisY.Min = 0;



 
pane1.AxisY.Max = 100;



 
pane1.AxisY.Min = 80;



 



 
//Hide the extra series from the legendbox



 
Chart1.LegendBox.ItemAttributes[Chart1.Series, 1].Visible = false;



 



 
}



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.

 Share

×
×
  • Create New...