Set color of Dundas’ PieChart segments

Request by a client to control the color of segments in a Pie Chart by using Dundas component.

Here is the sample code from my case:

ChartLanduse.Series["Default"].Type = SeriesChartType.Pie;

//Water, Forest, Grassland, Cropland, Urban, Unclassified

//Index: 0, 1, 2, 3, 4, 5

ChartLanduse.Series[

"Default"].Points[0].Color = Color.Blue;

ChartLanduse.Series[

"Default"].Points[1].Color = Color.Peru;

ChartLanduse.Series[

"Default"].Points[2].Color = Color.Green;

ChartLanduse.Series[

"Default"].Points[3].Color = Color.DarkKhaki;

ChartLanduse.Series[

"Default"].Points[4].Color = Color.DarkGray;

ChartLanduse.Series["Default"].Points[5].Color = Color.Black;

Advertisements

SQL Server 2008 Released

Get ready with SQL Server 2008 for years to come. It’s been a year since I took the academy class for What’s New in SQL Server 2008.
 
http://www.microsoft.com/presspass/press/2008/aug08/08-06SQLServer2008PR.mspx

Date range methods

There are a few smart ways to get a date range. I list them here for future reference.
1. Marc’s way: http://musingmarc.blogspot.com/2006/07/need-date-range-in-sql-without-filling.html
DECLARE @LowDate DATETIME
SET @LowDate = '01-01-2006'

DECLARE @HighDate DATETIME
SET @HighDate = '12-31-2016'

SELECT DISTINCT DATEADD(dd, Days.Row, DATEADD(mm, Months.Row, DATEADD(yy, Years.Row, @LowDate))) AS Date
FROM
(SELECT 0 AS Row UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 UNION ALL SELECT 13 UNION ALL SELECT 14
 UNION ALL SELECT 15 UNION ALL SELECT 16 UNION ALL SELECT 17 UNION ALL SELECT 18 UNION ALL SELECT 19
 UNION ALL SELECT 20 -- add more years here...
) AS Years
INNER JOIN
(SELECT 0 AS Row UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
 UNION ALL SELECT 10 UNION ALL SELECT 11
) AS Months
ON DATEADD(mm, Months.Row,  DATEADD(yy, Years.Row, @LowDate)) <= @HighDate 
INNER JOIN
(SELECT 0 AS Row UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 UNION ALL SELECT 13 UNION ALL SELECT 14
 UNION ALL SELECT 15 UNION ALL SELECT 16 UNION ALL SELECT 17 UNION ALL SELECT 18 UNION ALL SELECT 19
 UNION ALL SELECT 20 UNION ALL SELECT 21 UNION ALL SELECT 22 UNION ALL SELECT 23 UNION ALL SELECT 24
 UNION ALL SELECT 25 UNION ALL SELECT 26 UNION ALL SELECT 27 UNION ALL SELECT 28 UNION ALL SELECT 29
 UNION ALL SELECT 30
) AS Days
ON DATEADD(dd, Days.Row, DATEADD(mm, Months.Row,  DATEADD(yy, Years.Row, @LowDate))) <= @HighDate
WHERE DATEADD(yy, Years.Row, @LowDate) <= @HighDate
ORDER BY 1
2.Tom's code. (http://codeinet.blogspot.com/2006/08/auxiliary-calendar-table-for-sql.html)
DECLARE @LowDate DATETIME
SET @LowDate = '2006-01-01' -- Use iso 8601 for "datestrings"

DECLARE @HighDate DATETIME
SET @HighDate = '2016-12-31'
;
With Dates(MyDate)
AS
(
Select @LowDate MyDate
UNION ALL
SELECT (MyDate+1) MyDate
FROM Dates
WHERE
MyDate < @HighDate
)
SELECT MyDate FROM Dates
OPTION(MAXRECURSION 0)
3.Louis Davidson's
http://drsql.spaces.live.com/blog/cns!80677FB08B3162E4!1297.entry?wa=wsignin1.0

 
 

SQL Get data FROM a Month

SELECT * FROM dates WHERE

tdate

>CONVERT(Datetime,(Convert(varchar(2),@monthInt)+‘/1/’+‘2008’))AND tdate<

dateadd

(month,datediff(month,-1,CONVERT(Datetime,(Convert(varchar(2),@monthInt)+‘/1/’+‘2008’))),0)

Or

SELECT

* FROM dates WHERE

tdate

>CONVERT(Datetime,(Convert(varchar(2),@monthInt)+‘/1/’+Convert(varchar(4),@yearInt)))AND tdate<dateadd(month,datediff(month,-1,CONVERT(Datetime,(Convert(varchar(2),@monthInt)+‘/1/’+Convert(varchar(4),@yearInt)))),0)


SQL Month from Number to Name

DECLARE

@monthInt int
SET @monthInt = 6

select DateName(MONTH,Dateadd(month, @monthInt - 1, 0)) as MonthName

–June

 

DECLARE @input INT = 3

SELECT DATENAME(MONTH,@input*28) AS CurrentMonth

--March

--http://www.sql-server-performance.com/2004/datetime-datatype/7/