| Current Path : G:/PleskVhosts/mpcdp.in/cmamp.mpcdp.in/cdpp3/App_Code/ |
Windows NT SG2NWVPWEB022 10.0 build 17763 (Windows Server 2016) i586 |
| Current File : G:/PleskVhosts/mpcdp.in/cmamp.mpcdp.in/cdpp3/App_Code/Charts.vb |
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Collections.Generic
Imports System.Text
''' <summary>
''' Summary description for Charts
''' </summary>
Public MustInherit Class FusionChartBase
Public Const PercentSignCode As String = "%25"
Public Const undefinedIntegerValue As Integer = -9999
#Region "Private Variables"
Private _bgColor As String = "FFFFFF"
Private _bgAlpha As Integer = 100
Private _caption As String = "Caption"
Private _subCaption As String = "subCaption"
Private _showNames As Boolean = True
' 0 or 1
Private _showValues As Boolean = True
' 0 or 1
Private _baseFont As String = "Arial"
Private _baseFontSize As Integer = 10
Private _baseFontColor As String = "000000"
Private _numberPrefix As String = String.Empty
Private _numberSuffix As String = String.Empty
Private _formatNumber As Boolean = True
Private _formatNumberScale As Boolean = False
Private _decimalSeparator As String = "."
Private _thousandSeparator As String = ","
Private _decimalPrecision As Integer = 2
Private _showHovercap As Boolean = True
Private _hoverCapBgColor As String = "FFFFFF"
Private _hoverCapBorderColor As String = "000000"
Private _hoverCapSepChar As String = " - "
#End Region
#Region "Properties"
Public Property bgColor() As String
Get
Return _bgColor
End Get
Set(ByVal value As String)
_bgColor = value
End Set
End Property
Public Property bgAlpha() As Integer
Get
Return _bgAlpha
End Get
Set(ByVal value As Integer)
_bgAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property caption() As String
Get
Return _caption
End Get
Set(ByVal value As String)
_caption = value
End Set
End Property
Public Property subCaption() As String
Get
Return _subCaption
End Get
Set(ByVal value As String)
_subCaption = value
End Set
End Property
Public Property showNames() As Boolean
Get
Return _showNames
End Get
Set(ByVal value As Boolean)
_showNames = value
End Set
End Property
Public Property showValues() As Boolean
Get
Return _showValues
End Get
Set(ByVal value As Boolean)
_showValues = value
End Set
End Property
Public Property baseFont() As String
Get
Return _baseFont
End Get
Set(ByVal value As String)
_baseFont = value
End Set
End Property
Public Property baseFontSize() As Integer
Get
Return _baseFontSize
End Get
Set(ByVal value As Integer)
_baseFontSize = Convert.ToInt32(value)
End Set
End Property
Public Property baseFontColor() As String
Get
Return _baseFontColor
End Get
Set(ByVal value As String)
_baseFontColor = value
End Set
End Property
Public Property numberPrefix() As String
Get
Return _numberPrefix
End Get
Set(ByVal value As String)
_numberPrefix = value
End Set
End Property
Public Property numberSuffix() As String
Get
Return _numberSuffix
End Get
Set(ByVal value As String)
_numberSuffix = value
End Set
End Property
Public Property formatNumber() As Boolean
Get
Return _formatNumber
End Get
Set(ByVal value As Boolean)
_formatNumber = value
End Set
End Property
Public Property formatNumberScale() As Boolean
Get
Return _formatNumberScale
End Get
Set(ByVal value As Boolean)
_formatNumberScale = value
End Set
End Property
Public Property decimalSeparator() As String
Get
Return _decimalSeparator
End Get
Set(ByVal value As String)
_decimalSeparator = value
End Set
End Property
Public Property thousandSeparator() As String
Get
Return _thousandSeparator
End Get
Set(ByVal value As String)
_thousandSeparator = value
End Set
End Property
Public Property decimalPrecision() As Integer
Get
Return _decimalPrecision
End Get
Set(ByVal value As Integer)
_decimalPrecision = Convert.ToInt32(value)
End Set
End Property
Public Property showHovercap() As Boolean
Get
Return _showHovercap
End Get
Set(ByVal value As Boolean)
_showHovercap = value
End Set
End Property
Public Property hoverCapBgColor() As String
Get
Return _hoverCapBgColor
End Get
Set(ByVal value As String)
_hoverCapBgColor = value
End Set
End Property
Public Property hoverCapBorderColor() As String
Get
Return _hoverCapBorderColor
End Get
Set(ByVal value As String)
_hoverCapBorderColor = value
End Set
End Property
Public Property hoverCapSepChar() As String
Get
Return _hoverCapSepChar
End Get
Set(ByVal value As String)
_hoverCapSepChar = value
End Set
End Property
#End Region
#Region "Methods"
Public Function GetValue(ByVal value As Boolean) As String
If value Then
Return "'1'"
Else
Return "'0'"
End If
End Function
Public Function GetValue(ByVal value As String) As String
Return "'" & HttpUtility.HtmlEncode(value.Replace("&", "and")) & "'"
End Function
Public Function GetValue(ByVal value As Integer) As String
Return "'" & value.ToString() & "'"
End Function
'public virtual string CreateSetElement(DataTable dtChart, string chartId, bool multiSeries, string multiSeriesGroupField, string nameField, string valueField, string hoverTextField, string urlField, string urlPrefix, bool newWindow, int chartWidth, int chartHeight)
'{
' return "";
'}
#End Region
End Class
Public Class FusionPieChart
Inherits FusionChartBase
Private _pieRadius As Integer = 0
'FusionCharts automatically calculates the best fit pie radius for the chart.
Private _pieSliceDepth As Integer = 20
Private _pieYScale As Integer = 60
' 30 - 100
Private _pieBorderThickness As Integer = 1
Private _pieBorderAlpha As Integer = 100
Private _pieFillAlpha As Integer = 100
Private _showPercentageValues As Boolean = True
' 0 or 1
Private _showPercentageInLabel As Boolean = False
' 0 or 1
Public Const Pie2D As String = "FCF_Pie2D.swf"
Public Const Pie3D As String = "FCF_Pie3D.swf"
#Region "Properties"
Public Property pieSliceDepth() As Integer
Get
Return _pieSliceDepth
End Get
Set(ByVal value As Integer)
_pieSliceDepth = Convert.ToInt32(value)
End Set
End Property
Public Property pieYScale() As Integer
Get
Return _pieYScale
End Get
Set(ByVal value As Integer)
Dim scale As Integer = Convert.ToInt32(value)
If scale < 30 OrElse scale > 100 Then
Throw New Exception("PieYScale must be 30 - 100.")
End If
_pieYScale = scale
End Set
End Property
Public Property pieBorderThickness() As Integer
Get
Return _pieBorderThickness
End Get
Set(ByVal value As Integer)
_pieBorderThickness = Convert.ToInt32(value)
End Set
End Property
Public Property pieBorderAlpha() As Integer
Get
Return _pieBorderAlpha
End Get
Set(ByVal value As Integer)
_pieBorderAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property pieFillAlpha() As Integer
Get
Return _pieFillAlpha
End Get
Set(ByVal value As Integer)
_pieFillAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property showPercentageValues() As Boolean
Get
Return _showPercentageValues
End Get
Set(ByVal value As Boolean)
_showPercentageValues = value
End Set
End Property
Public Property showPercentageInLabel() As Boolean
Get
Return _showPercentageInLabel
End Get
Set(ByVal value As Boolean)
_showPercentageInLabel = value
End Set
End Property
#End Region
Public Function CreateSetElement(ByVal dtChart As DataTable, ByVal chartType As String, ByVal chartId As String, ByVal nameField As String, ByVal valueField As String, ByVal hoverTextField As String, _
ByVal urlField As String, ByVal urlPrefix As String, ByVal newWindow As Boolean, ByVal chartWidth As Integer, ByVal chartHeight As Integer) As String
Dim strXML As New StringBuilder()
'Initialize <graph> element
strXML.Append("<graph")
'base class (common) properties
strXML.Append(" bgColor=" & GetValue(bgColor))
strXML.Append(" bgAlpha=" & GetValue(bgAlpha))
strXML.Append(" caption=" & GetValue(caption))
strXML.Append(" subCaption=" & GetValue(subCaption))
strXML.Append(" showNames=" & GetValue(showNames))
strXML.Append(" showValues=" & GetValue(showValues))
strXML.Append(" showPercentageValues=" & GetValue(showPercentageValues))
strXML.Append(" showPercentageInLabel=" & GetValue(showPercentageInLabel))
strXML.Append(" baseFont=" & GetValue(baseFont))
strXML.Append(" baseFontSize=" & GetValue(baseFontSize))
strXML.Append(" baseFontColor=" & GetValue(baseFontColor))
strXML.Append(" numberPrefix=" & GetValue(numberPrefix))
strXML.Append(" numberSuffix=" & GetValue(numberSuffix))
strXML.Append(" formatNumber=" & GetValue(formatNumber))
strXML.Append(" formatNumberScale=" & GetValue(formatNumberScale))
strXML.Append(" decimalSeparator=" & GetValue(decimalSeparator))
strXML.Append(" thousandSeparator=" & GetValue(thousandSeparator))
strXML.Append(" decimalPrecision=" & GetValue(decimalPrecision))
strXML.Append(" showHovercap=" & GetValue(showHovercap))
strXML.Append(" hoverCapBgColor=" & GetValue(hoverCapBgColor))
strXML.Append(" hoverCapBorderColor=" & GetValue(hoverCapBorderColor))
strXML.Append(" hoverCapSepChar=" & GetValue(hoverCapSepChar))
'pie class properties
strXML.Append(" pieSliceDepth=" & GetValue(pieSliceDepth))
strXML.Append(" pieYScale=" & GetValue(pieYScale))
strXML.Append(" pieBorderThickness=" & GetValue(pieBorderThickness))
strXML.Append(" pieBorderAlpha=" & GetValue(pieBorderAlpha))
strXML.Append(" pieFillAlpha=" & GetValue(pieFillAlpha))
strXML.Append(">")
'Add all data
Dim utility As New FusionChartUtility()
For Each drChart As DataRow In dtChart.Rows
Dim name As String = drChart(nameField).ToString()
Dim value As String = drChart(4).ToString()
Dim text As String = drChart(4).ToString()
Dim url As String = String.Empty
If Not String.IsNullOrEmpty(urlField) Then
url = drChart(urlField).ToString()
End If
strXML.Append("<set name='")
strXML.Append(name)
strXML.Append("' value='")
strXML.Append(value)
strXML.Append("' ")
strXML.Append("color='")
strXML.Append(utility.getFCColor())
strXML.Append("' ")
If text.Trim().Length > 0 Then
strXML.Append(" hoverText=" & GetValue(text))
End If
If url.Trim().Length > 0 Then
If newWindow Then
strXML.Append(" link=" & GetValue("n-" & urlPrefix & url))
Else
strXML.Append(" link=" & GetValue(urlPrefix & url))
'strXML.Append("' link='default.aspx' />");
'strXML.Append("' link='n-default.aspx' />"); //new window
End If
End If
strXML.Append(" />")
Next
'Close <graph> element
strXML.Append("</graph>")
'Create the chart - Pie 3D Chart with data from strXML
Return InfoSoftGlobal.FusionCharts.RenderChartHTML("FusionCharts/" & chartType, "", strXML.ToString(), chartId, chartWidth.ToString(), chartHeight.ToString(), _
False)
End Function
End Class
Public Class FusionLineChart
Inherits FusionChartBase
Public Const Line2D As String = "FCF_Line.swf"
Public Const Area2D As String = "FCF_Area2D.swf"
Public Const MultiSeriesLine2D As String = "FCF_MSLine.swf"
Public Const MultiSeriesArea2D As String = "FCF_MSArea2D.swf"
Public Const Bar2D As String = "FCF_Bar2D.swf"
Public Const Bar2DColour As String = "E6EFF7"
Private _canvasBgColor As String = "FFFFFF"
Private _canvasBgAlpha As Integer = 100
Private _canvasBorderColor As String = "000000"
Private _canvasBorderThickness As Integer = 1
Private _xAxisName As String = "xAxisName"
Private _yAxisName As String = "yAxisName"
Private _yAxisMinValue As Integer = undefinedIntegerValue
Private _yAxisMaxValue As Integer = undefinedIntegerValue
Private _lineColor As String = "000000"
Private _lineThickness As Integer = 1
Private _lineAlpha As Integer = 100
Private _showShadow As Boolean = True
Private _shadowColor As String = "000000"
Private _shadowThickness As Integer = 3
Private _shadowAlpha As Integer = 10
Private _shadowXShift As Integer = 0
Private _shadowYShift As Integer = 4
Private _showAnchors As Boolean = True
' If the anchors are not shown, then the hover caption and link functions won't work.
Private _anchorSides As Integer = 3
' number > 3;
Private _anchorRadius As Integer = 5
Private _anchorBorderColor As String = ""
Private _anchorBorderThickness As Integer = 1
Private _anchorBgColor As String = ""
Private _anchorBgAlpha As Integer = 100
Private _anchorAlpha As Integer = 100
Private _divLineDecimalPrecision As Integer = 2
Private _limitsDecimalPrecision As Integer = 2
Private _numdivlines As Integer = 5
Private _divlinecolor As String = ""
Private _divLineThickness As Integer = 1
Private _divLineAlpha As Integer = 100
Private _showDivLineValue As Boolean = True
Private _showAlternateHGridColor As Boolean = False
Private _alternateHGridColor As String = ""
Private _alternateHGridAlpha As Integer = 100
Private _numVDivLines As Integer = 5
Private _VDivlinecolor As String = ""
Private _VDivLineThickness As Integer = 1
Private _VDivLineAlpha As Integer = 100
Private _showAlternateVGridColor As Boolean = False
Private _alternateVGridColor As String = ""
Private _alternateVGridAlpha As Integer = 100
Private _showLimits As Boolean = True
#Region "Properties"
Public Property canvasBgColor() As String
Get
Return _canvasBgColor
End Get
Set(ByVal value As String)
_canvasBgColor = value
End Set
End Property
Public Property canvasBgAlpha() As Integer
Get
Return _canvasBgAlpha
End Get
Set(ByVal value As Integer)
_canvasBgAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property canvasBorderColor() As String
Get
Return _canvasBorderColor
End Get
Set(ByVal value As String)
_canvasBorderColor = value
End Set
End Property
Public Property canvasBorderThickness() As Integer
Get
Return _canvasBorderThickness
End Get
Set(ByVal value As Integer)
_canvasBorderThickness = Convert.ToInt32(value)
End Set
End Property
Public Property xAxisName() As String
Get
Return _xAxisName
End Get
Set(ByVal value As String)
_xAxisName = value
End Set
End Property
Public Property yAxisName() As String
Get
Return _yAxisName
End Get
Set(ByVal value As String)
_yAxisName = value
End Set
End Property
Public Property yAxisMinValue() As Integer
Get
Return _yAxisMinValue
End Get
Set(ByVal value As Integer)
_yAxisMinValue = Convert.ToInt32(value)
End Set
End Property
Public Property yAxisMaxValue() As Integer
Get
Return _yAxisMaxValue
End Get
Set(ByVal value As Integer)
_yAxisMaxValue = Convert.ToInt32(value)
End Set
End Property
Public Property lineColor() As String
Get
Return _lineColor
End Get
Set(ByVal value As String)
_lineColor = value
End Set
End Property
Public Property lineThickness() As Integer
Get
Return _lineThickness
End Get
Set(ByVal value As Integer)
_lineThickness = Convert.ToInt32(value)
End Set
End Property
Public Property lineAlpha() As Integer
Get
Return _lineAlpha
End Get
Set(ByVal value As Integer)
_lineAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property showShadow() As Boolean
Get
Return _showShadow
End Get
Set(ByVal value As Boolean)
_showShadow = value
End Set
End Property
Public Property shadowColor() As String
Get
Return _shadowColor
End Get
Set(ByVal value As String)
_shadowColor = value
End Set
End Property
Public Property shadowThickness() As Integer
Get
Return _shadowThickness
End Get
Set(ByVal value As Integer)
_shadowThickness = Convert.ToInt32(value)
End Set
End Property
Public Property shadowAlpha() As Integer
Get
Return _shadowAlpha
End Get
Set(ByVal value As Integer)
_shadowAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property shadowXShift() As Integer
Get
Return _shadowXShift
End Get
Set(ByVal value As Integer)
_shadowXShift = Convert.ToInt32(value)
End Set
End Property
Public Property shadowYShift() As Integer
Get
Return _shadowYShift
End Get
Set(ByVal value As Integer)
_shadowYShift = Convert.ToInt32(value)
End Set
End Property
Public Property showAnchors() As Boolean
' If the anchors are not shown, then the hover caption and link functions won't work.
Get
Return _showAnchors
End Get
Set(ByVal value As Boolean)
_showAnchors = value
End Set
End Property
Public Property anchorSides() As Integer
' number > 3;
Get
Return _anchorSides
End Get
Set(ByVal value As Integer)
_anchorSides = Convert.ToInt32(value)
End Set
End Property
Public Property anchorRadius() As Integer
Get
Return _anchorRadius
End Get
Set(ByVal value As Integer)
_anchorRadius = Convert.ToInt32(value)
End Set
End Property
Public Property anchorBorderColor() As String
Get
Return _anchorBorderColor
End Get
Set(ByVal value As String)
_anchorBorderColor = value
End Set
End Property
Public Property anchorBorderThickness() As Integer
Get
Return _anchorBorderThickness
End Get
Set(ByVal value As Integer)
_anchorBorderThickness = Convert.ToInt32(value)
End Set
End Property
Public Property anchorBgColor() As String
Get
Return _anchorBgColor
End Get
Set(ByVal value As String)
_anchorBgColor = value
End Set
End Property
Public Property anchorBgAlpha() As Integer
Get
Return _anchorBgAlpha
End Get
Set(ByVal value As Integer)
_anchorBgAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property anchorAlpha() As Integer
Get
Return _anchorAlpha
End Get
Set(ByVal value As Integer)
_anchorAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property divLineDecimalPrecision() As Integer
Get
Return _divLineDecimalPrecision
End Get
Set(ByVal value As Integer)
_divLineDecimalPrecision = Convert.ToInt32(value)
End Set
End Property
Public Property limitsDecimalPrecision() As Integer
Get
Return _limitsDecimalPrecision
End Get
Set(ByVal value As Integer)
_limitsDecimalPrecision = Convert.ToInt32(value)
End Set
End Property
Public Property numDivLines() As Integer
Get
Return _numdivlines
End Get
Set(ByVal value As Integer)
_numdivlines = Convert.ToInt32(value)
End Set
End Property
Public Property divLineColor() As String
Get
Return _divlinecolor
End Get
Set(ByVal value As String)
_divlinecolor = value
End Set
End Property
Public Property divLineThickness() As Integer
Get
Return _divLineThickness
End Get
Set(ByVal value As Integer)
_divLineThickness = Convert.ToInt32(value)
End Set
End Property
Public Property divLineAlpha() As Integer
Get
Return _divLineAlpha
End Get
Set(ByVal value As Integer)
_divLineAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property showDivLineValue() As Boolean
Get
Return _showDivLineValue
End Get
Set(ByVal value As Boolean)
_showDivLineValue = Convert.ToBoolean(value)
End Set
End Property
Public Property showAlternateHGridColor() As Boolean
Get
Return _showAlternateHGridColor
End Get
Set(ByVal value As Boolean)
_showAlternateHGridColor = Convert.ToBoolean(value)
End Set
End Property
Public Property alternateHGridColor() As String
Get
Return _alternateHGridColor
End Get
Set(ByVal value As String)
_alternateHGridColor = value
End Set
End Property
Public Property alternateHGridAlpha() As Integer
Get
Return _alternateHGridAlpha
End Get
Set(ByVal value As Integer)
_alternateHGridAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property numVDivLines() As Integer
Get
Return _numVDivLines
End Get
Set(ByVal value As Integer)
_numVDivLines = Convert.ToInt32(value)
End Set
End Property
Public Property VDivLineColor() As String
Get
Return _VDivlinecolor
End Get
Set(ByVal value As String)
_VDivlinecolor = value
End Set
End Property
Public Property VDivLineThickness() As Integer
Get
Return _VDivLineThickness
End Get
Set(ByVal value As Integer)
_VDivLineThickness = Convert.ToInt32(value)
End Set
End Property
Public Property VDivLineAlpha() As Integer
Get
Return _VDivLineAlpha
End Get
Set(ByVal value As Integer)
_VDivLineAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property showAlternateVGridColor() As Boolean
Get
Return _showAlternateVGridColor
End Get
Set(ByVal value As Boolean)
_showAlternateVGridColor = value
End Set
End Property
Public Property alternateVGridColor() As String
Get
Return _alternateVGridColor
End Get
Set(ByVal value As String)
_alternateVGridColor = value
End Set
End Property
Public Property alternateVGridAlpha() As Integer
Get
Return _alternateVGridAlpha
End Get
Set(ByVal value As Integer)
_alternateVGridAlpha = Convert.ToInt32(value)
End Set
End Property
Public Property showLimits() As Boolean
Get
Return _showLimits
End Get
Set(ByVal value As Boolean)
_showLimits = value
End Set
End Property
#End Region
Public Function CreateSetElememtForTrendChart(ByVal dtChart As DataTable, ByVal chartId As String, ByVal nameField As String, ByVal valueField As String, ByVal chartWidth As Integer, ByVal chartHeight As Integer, _
ByVal yAxisMinValue As Integer, ByVal yAxisMaxValue As Integer, ByVal backColor As String) As String
Dim strXML As New StringBuilder()
strXML.Append("<graph decimalPrecision='0' showNames='0' showValues='0' showLimits='0' canvasBorderThickness='0' showAnchors='0' showDivLineValue='0' divLineAlpha='0' showShadow='0' chartTopMargin='1' chartBottomMargin='2' areaBgColor='DFEFF7' showAreaBorder='1' areaBorderColor='00769C' areaBorderThickness='1' showhovercap='0' yAxisMinValue='")
strXML.Append(yAxisMinValue)
strXML.Append("' yAxisMaxValue='")
strXML.Append(yAxisMaxValue)
strXML.Append("' canvasBgColor='")
strXML.Append(backColor)
strXML.Append("' canvasBorderColor='")
strXML.Append(backColor)
strXML.Append("' bgColor='")
strXML.Append(backColor)
strXML.Append("'>")
For Each drChart As DataRow In dtChart.Rows
Dim name As String = drChart(nameField).ToString()
Dim value As String = drChart(valueField).ToString()
strXML.Append("<set name='")
strXML.Append(name)
strXML.Append("' value='")
strXML.Append(value)
strXML.Append("' ")
strXML.Append(" />")
Next
strXML.Append("</graph>")
'Create the chart - Pie 3D Chart with data from strXML
Return InfoSoftGlobal.FusionCharts.RenderChartHTML("FusionCharts/" & FusionLineChart.Area2D, "", strXML.ToString(), chartId, chartWidth.ToString(), chartHeight.ToString(), _
False)
End Function
Public Function CreateSetElement(ByVal dtChart As DataTable, ByVal chartType As String, ByVal chartId As String, ByVal multiSeries As Boolean, ByVal multiSeriesGroupField As String, ByVal nameField As String, _
ByVal valueField As String, ByVal hoverTextField As String, ByVal urlField As String, ByVal urlPrefix As String, ByVal newWindow As Boolean, ByVal chartWidth As Integer, _
ByVal chartHeight As Integer) As String
Dim strXML As New StringBuilder()
'Initialize <graph> element
strXML.Append("<graph")
'base class (common) properties
strXML.Append(" bgColor=" & GetValue(bgColor))
strXML.Append(" bgAlpha=" & GetValue(bgAlpha))
strXML.Append(" caption=" & GetValue(caption))
strXML.Append(" subCaption=" & GetValue(subCaption))
strXML.Append(" showNames=" & GetValue(showNames))
strXML.Append(" showValues=" & GetValue(showValues))
strXML.Append(" baseFont=" & GetValue(baseFont))
strXML.Append(" baseFontSize=" & GetValue(baseFontSize))
strXML.Append(" baseFontColor=" & GetValue(baseFontColor))
strXML.Append(" numberPrefix=" & GetValue(numberPrefix))
strXML.Append(" numberSuffix=" & GetValue(numberSuffix))
strXML.Append(" formatNumber=" & GetValue(formatNumber))
strXML.Append(" formatNumberScale=" & GetValue(formatNumberScale))
strXML.Append(" decimalSeparator=" & GetValue(decimalSeparator))
strXML.Append(" thousandSeparator=" & GetValue(thousandSeparator))
strXML.Append(" decimalPrecision=" & GetValue(decimalPrecision))
strXML.Append(" showHovercap=" & GetValue(showHovercap))
strXML.Append(" hoverCapBgColor=" & GetValue(hoverCapBgColor))
strXML.Append(" hoverCapBorderColor=" & GetValue(hoverCapBorderColor))
strXML.Append(" hoverCapSepChar=" & GetValue(hoverCapSepChar))
strXML.Append(" showLimits=" & GetValue(showLimits))
'line class properties
strXML.Append(" canvasBgColor=" & GetValue(canvasBgColor))
strXML.Append(" canvasBgAlpha=" & GetValue(canvasBgAlpha))
strXML.Append(" canvasBorderColor=" & GetValue(canvasBorderColor))
strXML.Append(" canvasBorderThickness=" & GetValue(canvasBorderThickness))
strXML.Append(" xAxisName=" & GetValue(xAxisName))
strXML.Append(" yAxisName=" & GetValue(yAxisName))
If yAxisMinValue <> undefinedIntegerValue Then
strXML.Append(" yAxisMinValue=" & GetValue(yAxisMinValue))
End If
If yAxisMaxValue <> undefinedIntegerValue Then
strXML.Append(" yAxisMaxValue=" & GetValue(yAxisMaxValue))
End If
'strXML.Append(" lineColor=" + GetValue(lineColor)); // should be controlled in set tag.
strXML.Append(" lineThickness=" & GetValue(lineThickness))
strXML.Append(" lineAlpha=" & GetValue(lineAlpha))
If showShadow Then
strXML.Append(" showShadow=" & GetValue(showShadow))
strXML.Append(" shadowColor=" & GetValue(shadowColor))
strXML.Append(" shadowThickness=" & GetValue(shadowThickness))
strXML.Append(" shadowAlpha=" & GetValue(shadowAlpha))
strXML.Append(" shadowXShift=" & GetValue(shadowXShift))
strXML.Append(" shadowYShift=" & GetValue(shadowYShift))
End If
If showAnchors Then
strXML.Append(" showAnchors=" & GetValue(showAnchors))
strXML.Append(" anchorSides=" & GetValue(anchorSides))
strXML.Append(" anchorRadius=" & GetValue(anchorRadius))
strXML.Append(" anchorBorderColor=" & GetValue(anchorBorderColor))
strXML.Append(" anchorBorderThickness=" & GetValue(anchorBorderThickness))
strXML.Append(" anchorBgColor=" & GetValue(anchorBgColor))
strXML.Append(" anchorBgAlpha=" & GetValue(anchorBgAlpha))
strXML.Append(" anchorAlpha=" & GetValue(anchorAlpha))
End If
strXML.Append(" divLineDecimalPrecision=" & GetValue(divLineDecimalPrecision))
strXML.Append(" limitsDecimalPrecision=" & GetValue(limitsDecimalPrecision))
'strXML.Append(" numdivlines=" + GetValue(numDivLines));
strXML.Append(" divlinecolor=" & GetValue(divLineColor))
strXML.Append(" divLineThickness=" & GetValue(divLineThickness))
strXML.Append(" divLineAlpha=" & GetValue(divLineAlpha))
strXML.Append(" showDivLineValue=" & GetValue(showDivLineValue))
If showAlternateHGridColor Then
strXML.Append(" showAlternateHGridColor=" & GetValue(showAlternateHGridColor))
strXML.Append(" alternateHGridColor=" & GetValue(alternateHGridColor))
strXML.Append(" alternateHGridAlpha=" & GetValue(alternateHGridAlpha))
End If
'strXML.Append(" numVDivLines=" + GetValue(numVDivLines));
strXML.Append(" VDivlinecolor=" & GetValue(VDivLineColor))
strXML.Append(" VDivLineThickness=" & GetValue(VDivLineThickness))
strXML.Append(" VDivLineAlpha=" & GetValue(VDivLineAlpha))
If showAlternateVGridColor Then
strXML.Append(" showAlternateVGridColor=" & GetValue(showAlternateVGridColor))
strXML.Append(" alternateVGridColor=" & GetValue(alternateVGridColor))
strXML.Append(" alternateVGridAlpha=" & GetValue(alternateVGridAlpha))
End If
strXML.Append(">")
'Add all data
Dim utility As New FusionChartUtility()
If multiSeries Then
Dim dsHelper As New DataSetHelper()
Dim listUnique As New List(Of String)()
listUnique.Add(nameField)
Dim dtUnique As DataTable = dsHelper.RemoveDuplicates(dtChart, listUnique)
Dim categories As New StringBuilder()
Dim datasets As New StringBuilder()
categories.Append("<categories>")
For Each drUnique As DataRow In dtUnique.Rows
Dim currentName As String = drUnique(nameField).ToString()
categories.Append("<category name=")
categories.Append(GetValue(currentName))
categories.Append(" />")
Next
categories.Append("</categories>")
listUnique = New List(Of String)()
listUnique.Add(multiSeriesGroupField)
dtUnique = dsHelper.RemoveDuplicates(dtChart, listUnique)
'DataRow[] drs = dtChart.Select(nameField + "=" + GetValue(currentName));
For Each drUnique As DataRow In dtUnique.Rows
Dim currentGroup As String = drUnique(multiSeriesGroupField).ToString()
Dim drs As DataRow() = dtChart.[Select](multiSeriesGroupField & "=" & GetValue(currentGroup))
If drs.Length > 0 Then
datasets.Append("<dataset seriesname=")
datasets.Append(GetValue(drUnique(nameField).ToString()))
datasets.Append(" color=")
datasets.Append(GetValue(utility.getFCColor()))
datasets.Append(" >")
For Each drData As DataRow In drs
datasets.Append("<set value=")
datasets.Append(GetValue(drData(valueField).ToString()))
datasets.Append(" />")
Next
datasets.Append("</dataset>")
End If
Next
strXML.Append(categories.ToString())
strXML.Append(datasets.ToString())
Else
For Each drChart As DataRow In dtChart.Rows
Dim name As String = drChart(nameField).ToString()
Dim value As String = drChart(4).ToString()
Dim text As String = String.Empty
If Not String.IsNullOrEmpty(hoverTextField) Then
text = drChart(4).ToString()
End If
Dim url As String = String.Empty
If Not String.IsNullOrEmpty(urlField) Then
url = drChart(urlField).ToString()
End If
strXML.Append("<set name='")
strXML.Append(name)
strXML.Append("' value='")
strXML.Append(value)
strXML.Append("' ")
strXML.Append("color='")
'if (chartType == FusionLineChart.Bar2D)
'{
' strXML.Append(FusionLineChart.Bar2DColour);
'}
'else
'{
strXML.Append(utility.getFCColor())
'}
strXML.Append("' ")
If text.Trim().Length > 0 Then
strXML.Append(" hoverText=" & GetValue(text))
End If
If url.Trim().Length > 0 Then
If newWindow Then
strXML.Append(" link=" & GetValue("n-" & urlPrefix & url))
Else
strXML.Append(" link=" & GetValue(urlPrefix & url))
'strXML.Append("' link='default.aspx' />");
'strXML.Append("' link='n-default.aspx' />"); //new window
End If
End If
strXML.Append(" />")
Next
End If
' end multi series
'Close <graph> element
strXML.Append("</graph>")
'Create the chart - Pie 3D Chart with data from strXML
Return InfoSoftGlobal.FusionCharts.RenderChartHTML("FusionCharts/" & chartType, "", strXML.ToString(), chartId, chartWidth.ToString(), chartHeight.ToString(), _
False)
End Function
End Class
Public Class FusionChartUtility
'private string[] arr_FCColors;
Private FC_ColorCounter As Integer
Private listColors As New List(Of String)()
Public Sub New()
'
' * This page contains an array of colors to be used as default set of colors for FusionCharts
' * arr_FCColors is the array that would contain the hex code of colors
' * ALL COLORS HEX CODES TO BE USED WITHOUT #
' *
' * We also initiate a counter variable to help us cyclically rotate through
' * the array of colors.
'
FC_ColorCounter = 0
'arr_FCColors = new string[27];
listColors.Add("E48700")
listColors.Add("A5BC4E")
listColors.Add("C7C79E")
listColors.Add("1895D7")
listColors.Add("EF5E27")
listColors.Add("6691AF")
listColors.Add("86CFE4")
listColors.Add("1941A5")
'Dark Blue
listColors.Add("AFD8F8")
listColors.Add("F6BD0F")
listColors.Add("8BBA00")
listColors.Add("A66EDD")
listColors.Add("F984A1")
listColors.Add("CCCC00")
'Chrome Yellow+Green
listColors.Add("999999")
'Grey
listColors.Add("0099CC")
'Blue Shade
listColors.Add("FF0000")
'Bright Red
listColors.Add("006F00")
'Dark Green
listColors.Add("0099FF")
'Blue (Light)
listColors.Add("FF66CC")
'Dark Pink
listColors.Add("669966")
'Dirty green
listColors.Add("7C7CB4")
'Violet shade of blue
listColors.Add("FF9933")
'Orange
listColors.Add("9900FF")
'Violet
listColors.Add("99FFCC")
'Blue+Green Light
listColors.Add("CCCCFF")
'Light violet
'Shade of green
'
' arr_FCColors[0] = "E48700";
' arr_FCColors[1] = "A5BC4E";
' arr_FCColors[2] = "1895D7";
' arr_FCColors[3] = "C7C79E";
' arr_FCColors[4] = "6691AF";
' arr_FCColors[5] = "EF5E27";
' arr_FCColors[6] = "86CFE4";
'
' arr_FCColors[7] = "1941A5"; //Dark Blue
' arr_FCColors[8] = "AFD8F8";
' arr_FCColors[9] = "F6BD0F";
' arr_FCColors[10] = "8BBA00";
' arr_FCColors[11] = "A66EDD";
' arr_FCColors[12] = "F984A1";
' arr_FCColors[13] = "CCCC00"; //Chrome Yellow+Green
' arr_FCColors[14] = "999999"; //Grey
' arr_FCColors[15] = "0099CC"; //Blue Shade
' arr_FCColors[16] = "FF0000"; //Bright Red
' arr_FCColors[17] = "006F00"; //Dark Green
' arr_FCColors[18] = "0099FF"; //Blue (Light)
' arr_FCColors[19] = "FF66CC"; //Dark Pink
' arr_FCColors[20] = "669966"; //Dirty green
' arr_FCColors[21] = "7C7CB4"; //Violet shade of blue
' arr_FCColors[22] = "FF9933"; //Orange
' arr_FCColors[23] = "9900FF"; //Violet
' arr_FCColors[24] = "99FFCC"; //Blue+Green Light
' arr_FCColors[25] = "CCCCFF"; //Light violet
' arr_FCColors[26] = "669900"; //Shade of green
'
listColors.Add("669900")
End Sub
'getFCColor method helps return a color from arr_FCColors array. It uses
'cyclic iteration to return a color from a given index. The index value is
'maintained in FC_ColorCounter
Public Function getFCColor() As String
'Update index
FC_ColorCounter += 1
'Return color
'return arr_FCColors[FC_ColorCounter % arr_FCColors.Length];
Return (listColors.ToArray())(FC_ColorCounter Mod listColors.Count)
End Function
End Class