Jump to content
Software FX Community

Daily, Weekly, Monthly series


Oops

Recommended Posts

Hello

 I have a requirement to make a chart which shows the daily , weekly and monthly average of some data for the same time period, as a line chart with 3 different lines for the three categories.

I have all the data in 3 different datatables (and can mix them into 1 too).  i tried merging all the datatables into 1 and then setting it as the datasource but without correct results. The weekly and monthly line should have points only at the start of every week and month but i couldnt get that to happen. -- Basically if im plotting 60 days then there shud be 60 points on the Day series line,  8 week points on the weeks line  and 2 month points connected by the month series line..hope u get the idea ....

How can this be done correctly. Am i supposed to be making different series' and If i make different series how am i supposed to populate them with date strings for the x axis and the corresponding values for the y axis? I have been through the documentation and havent found this. Really  would appreciate some help on this. Many Thanks.

Link to comment
Share on other sites

The key here is X-Values.

Instead of passing string labels, you must pass X-Values for each series, in this case a DateTime.

For example:

// Daily data

chart.Data.X[0,0] = (new DateTime(2000,1,1).ToOADate());

chart.Data.X[0,1] = (new DateTime(2000,1,2).ToOADate());

chart.Data.X[0,2] = (new DateTime(2000,1,3).ToOADate());

chart.Data.X[0,3] = (new DateTime(2000,1,4).ToOADate());

chart.Data.X[0,4] = (new DateTime(2000,1,5).ToOADate());

chart.Data.X[0,5] = (new DateTime(2000,1,6).ToOADate());

chart.Data.X[0,6] = (new DateTime(2000,1,7).ToOADate());

chart.Data.X[0,7] = (new DateTime(2000,1,8).ToOADate());

chart.Data.X[0,8] = (new DateTime(2000,1,9).ToOADate());

chart.Data.X[0,9] = (new DateTime(2000,1,10).ToOADate());

chart.Data.X[0,10] = (new DateTime(2000,1,11).ToOADate());

chart.Data.X[0,11] = (new DateTime(2000,1,12).ToOADate());

chart.Data.X[0,12] = (new DateTime(2000,1,13).ToOADate());

chart.Data.X[0,13] = (new DateTime(2000,1,14).ToOADate());

chart.Data.X[0,14] = (new DateTime(2000,1,15).ToOADate());

chart.Data.X[0,15] = (new DateTime(2000,1,16).ToOADate());

// Weekly data

chart.Data.X[1,0] = (new DateTime(2000,1,1).ToOADate());

chart.Data.X[1,1] = (new DateTime(2000,1,8).ToOADate());

chart.Data.X[1,2] = (new DateTime(2000,1,15).ToOADate());

...

Databinding can also be done, your columns must be like this:

Date1  DailyValue Date2 Weekly Value

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...