Jump to content
Software FX Community

Column chart to start at y=0


Recommended Posts

 I'm trying to draw a column chart  with all bars starting at y=0 and moving to the y value, ie negative values will have their bars below the y=0 line, while positive values will have their bars above the y=0 line.

 What I'm getting is all bars starting at the minimum y value (example -0.2) and moving up to the y value, like an area chart.

 What property changes this behavior? 

Link to comment
Share on other sites

Hi, I have just tried to reproduce your issue in my test app and failed. Whatever I try the columns behave as you wanted (ie start at 0 and go +ve or -ve).

Code used was:

  <cfx:Chart>   <cfx:Chart.PlotArea>   <cfx:PlotAreaAttributes ClipToBounds="true"/>   </cfx:Chart.PlotArea>   </cfx:Chart>

and code behind was


  ctlChart1.Gallery = Gallery.Bar;

  ctlChart1.Series.Clear();   SeriesAttributes dataSeries0 = CreateNewDataSeries(false, 10, 7.5, 30.0, -5.0, 0);   ctlChart1.Series.Add(dataSeries0);

  ctlChart1.AxisY.AutoScale = true;

  ctlChart1.AxisX.AutoScale = true; 

My DataSeries just exposes an X and Y property for each point.

If you can post your sample code it might be easier to trace the issue.

Link to comment
Share on other sites

Heres my code:

      Dim sTable1 As System.Data.DataTable = GetSeries(....

  Dim series1 As New SeriesAttributes   series1.ItemsSource = sTable1.Rows   series1.BindingPath = "SERIES1"       series1.Gallery = Gallery.Bar       fxChart.Series.Clear()   fxChart.Series.Add(series1) 

 I'm binding to a datatable that looks like this:

 DATE  SERIES1  SERIES2  SERIES3  2007/04/30 12:00:00 AM   0.0374   0.0381994776     2007/05/31 12:00:00 AM   0.012625258   0.0106750797     2007/06/30 12:00:00 AM   -0.0088050042   -0.008834297     2007/07/31 12:00:00 AM   0.009730482   0.0095879535     ..

Also I've noticed fxChart.pointcount = 5,and fxChart.points.count = 0








Link to comment
Share on other sites

I have taken your code and data and created a simple table in a DB where the fields are Date, Series1, Series2 etc. Date is the date/Time info, Series1 is the first double list etc.

Using my previous xaml, I have used this code behind and it still works. Can you confirm that you are using the latest beta (v0.8.2957.30556 - dated 12th Feb) as that might be the only difference.

  string ConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}", @"c:\Db1.mdb");

  OleDbConnection Connection = new OleDbConnection(ConnectionString);

  OleDbCommand Command = new OleDbCommand("Select * from [ForumTable1]", Connection);

  OleDbDataAdapter DataAdapter = new OleDbDataAdapter(Command);

  DataSet dataset = new DataSet();

  DataAdapter.Fill(dataset, "ForumTable1");

  SeriesAttributes dataSeries0 = new SeriesAttributes();

  dataSeries0.ItemsSource = dataset.Tables["ForumTable1"].Rows;

  dataSeries0.BindingPath = "Series1";

  dataSeries0.Gallery = Gallery.Bar;



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.

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