By Default, the top left corner it shows
Past 7 Days and Past 6 Months
Any way to add in the Month to date? or even Year to Date?
Thanks
Chris
Customize Admin Dashboard
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Customize Admin Dashboard
It looks like you might be able to do it in Admin/Dashboard/SalesOverTime.ascs.cs by adding two sections of code using the following that is already there as a pattern.
As a start, try changing
private void initMonthChart(bool forceRefresh) to another name, the cache key, and then ReportDataSource.GetSalesForPastMonths(6, true); to 12 instead of 6 for months
Code: Select all
private void initMonthChart(bool forceRefresh)
{
string cacheKey = "39C69D16-CD5A-4287-8DD4-E21019A78B8E";
CacheWrapper cacheWrapper = Cache[cacheKey] as CacheWrapper;
if (forceRefresh || (cacheWrapper == null))
{
//LOAD VIEWS
SortableCollection<KeyValuePair<DateTime, decimal>> salesByMonth = ReportDataSource.GetSalesForPastMonths(6, true);
//BUILD BAR CHART
WebChart.ColumnChart chart = (ColumnChart)SalesByMonthChart.Charts[0];
for (int i = 0; i < salesByMonth.Count; i++)
{
int roundedTotal = (int)Math.Round(salesByMonth[i].Value, 0);
chart.Data.Add(new ChartPoint(salesByMonth[i].Key.ToString("MMM yy"), roundedTotal));
}
chart.MaxColumnWidth = 30;
//BIND THE CHART
SalesByMonthChart.RedrawChart();
//CACHE THE DATA
cacheWrapper = new CacheWrapper(SalesByMonthChart.ImageID);
Cache.Remove(cacheKey);
Cache.Add(cacheKey, cacheWrapper, null, DateTime.UtcNow.AddMinutes(5).AddSeconds(-1), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.High, null);
}
else
{
//USE CACHED VALUES
SalesByMonthChart.ImageID = (string)cacheWrapper.CacheValue;
}
_CacheDate = cacheWrapper.CacheDate;
}
private void initMonthChart(bool forceRefresh) to another name, the cache key, and then ReportDataSource.GetSalesForPastMonths(6, true); to 12 instead of 6 for months
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 36
- Joined: Mon Jul 21, 2008 3:45 pm
Re: Customize Admin Dashboard
Is there any significance in generating a new cache key? Or can you simply just change it to another string?
Besides renaming the section of code to my value, what else (if anything) needs to be changed?
Which values need to be linked to the SalesOverTime.ascx file?
Besides renaming the section of code to my value, what else (if anything) needs to be changed?
Which values need to be linked to the SalesOverTime.ascx file?
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Customize Admin Dashboard
On the cache key- I think it would have to be different because you are storing different data. On generating it, I just don't know. Maybe someone at Able can chime in.
On other changes that might be necessary, I didn't notice any, but I didn't try the code for real. I have a very "scientific" method when I do something like that- I change it and see what broke, what kind of error messages I got and fix what broke.
On other changes that might be necessary, I didn't notice any, but I didn't try the code for real. I have a very "scientific" method when I do something like that- I change it and see what broke, what kind of error messages I got and fix what broke.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx