Charts help

Hi All,

I am sort of at a dead end and not sure how to proceed.  Hope I can get some help/insight on how to go forward.

I created chart using google api in SharePoint 2007.  It looks somewhat like this http://jsfiddle.net/asgallant/GTpgA/36/

Here's a picture of it in SharePoint


Here's my problem, as you can see, the x-axis uses months but the client has changed it to actual dates in the fiscal year.  So, it should be like this

These dates are in a list with associated data to plot. These dates represent all dates, separated by a week, in a fiscal year starting with October 4, 2012.

Previously I created a multidimensional array that would allow me to plot my lines graphs by month.


 I was then able to pick which index to manipulate like so dataValues[monthProjectedIndex][10] += parseInt(checkForUndefined($(this).attr("ows_Plan")));

The dates make it somewhat difficult because there are 52/53 weeks in a fiscal year and I don't want to manually create an array with all the date values.

Any ideas?  Code attached.
LVL 5
IsaacSharePoint Client Side DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
Hi,
as I understand, you will have an entry in your (chart) data array for each week starting with October, 4th 2012.
Therefore I would create a simple helper function which will return a value representing the index like
function returnWeekindexSince(datevalfromsp) {
var basedate = new Date(2012,9,4);
var checkdate = new Date(datevalfromsp);
var timecheck = checkdate .getTime();
var timebase = basedate .getTime();

var weekindex = parseInt((t2-t1)/(24*3600*1000*7));
if (weekindex < 0) {
// if necessary - propper error handling here
} else { return weekindex;}
}

Open in new window


You just have to ensure, that you pass either a correct date string to the function or use a helper library to pass directly a date variable.
Perhaps you would also need a function to initialize the data array by getting the maximum week index (CAML query on the date column, rowlimit 1, order by date column desc).
HTH
Rainer

BTW, completely different approach: as it seems from your last questions, you are reaching the limits of MOSS2007, CAML and client side scripting in regards to complexity, duration and server performance. As MOSS 2007 and CAML are very very limited (no SELECT DISTINCT, SELECT SUM ... equivalents) and due to the fact that you will run the  same queries and calculation each time the chart is shown, you might think of starting to implement your own web service, which can use server side object model, using the property bag for caching the results and eventually even updating the cache when something in the list has changed. Just my 2ct.
0
Rainer JeschorCommented:
Sorry,
had some typos in there:
function returnWeekindexSince(datevalfromsp) {
var basedate = new Date(2012,9,4);
var checkdate = new Date.parse(datevalfromsp);
var timecheck = checkdate .getTime();
var timebase = basedate .getTime();

var weekindex = parseInt((timecheck-timebase)/(24*3600*1000*7));
if (weekindex < 0) {
// if necessary - propper error handling here
} else { return weekindex;}
}

Open in new window

And jsFiddler:
http://jsfiddle.net/EE_RainerJ/cCrG2/
HTH
Rainer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.