Jump to content
Software FX Community

X Axis


prcunningham
 Share

Recommended Posts

Please try the following code:

DataTable dt = new DataTable();DataColumn dc1 = new DataColumn();dc1.ColumnName = "X";dc1.DataType = Type.GetType("System.Int32");DataColumn dc2 = new DataColumn();dc2.ColumnName = "Y";dc2.DataType = Type.GetType("System.Int32");dt.Columns.Add(dc1);dt.Columns.Add(dc2);......

 DataTableProvider data = new ChartFX.WebForms.DataProviders. DataTableProvider (dt);

chart1.DataSourceSettings.Fields.Add( new FieldMap ( "X" , FieldUsage .XValue)); //Setting X axis

chart1.DataSourceSettings.Fields.Add( new FieldMap ( "Y" , FieldUsage .Value)); //Setting series chart1.DataSource = data;

 

Link to comment
Share on other sites

This my code. How do I attach a image?  I tried dragging on the default data thats loaded when the chart first comes up and it did the same thing. 

 

dt = New DataTable("Test")

Dim cols() As String = {"Total Time", "Time", "Bot Temp", "Pressure", "Top Temp", "MFC4", "Argon", "ArN2", "Vent"}For Each col As String In cols

dt.Columns.Add(col, Type.GetType(

"System.Single"))

Next

 

cfx.Series.Clear()

cfx.DataSourceSettings.Fields.Add(New FieldMap("Total Time", FieldUsage.XValue))

For Each dc As DataColumn In dt.ColumnsIf Not dc.ColumnName.Equals("Total Time") Then cfx.DataSourceSettings.Fields.Add(New FieldMap(dc.ColumnName, FieldUsage.Value))

Next

cfx.DataSourceSettings.DataSource =

New DataTableProvider(dt)
Link to comment
Share on other sites

The way to achieve what you want is by processing the DataChangedByUser event as follows:

private void chart1_DataChangedByUser (object sender,PointLabelEventArgs e)

{

  if (e.Axis == chart1.AxisX)

  e.Handled = true; // Prevent change of X-Axis values

}

Please try it and let me know if it works for you.

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...