Line Chart with Different Colors in single series

Thread is closed for posting
5 posts, 0 answers
  1. rakesh
    rakesh avatar
    2 posts
    Member since:
    Feb 2008

    Posted 23 Mar 2009 Link to this post

    Hi,

    I have one problem with Line Chart.
    i want to display a status of some network connections with Line Chart. meanse connected a between a stations.
    now, i want to display like that

    station1 ---------------station2--------------------------station3

    with a diffrent color of line. like station1 to station2 is in red color because connection is lost .while station2 to station3 is green line beacuse connection is exits.

    so, what should i do for that. and please suggest me which chart i need to use other than Line Chart.

    please see attached image.


  2. Dessy
    Admin
    Dessy avatar
    73 posts

    Posted 23 Mar 2009 Link to this post

    Hello rakesh,

    Thank you for the provided information regarding your question.

    Line chart type is an appropriate model for displaying  a status of network connections. 
    Unfortunately there is no designed property for creating  line chart with different colors in a single series.
    But there is other possibility through which you can achieve this . You could  create several chart series with different colors and then provide for each point of the line series with the appropriate coordinates, so that the series follow one another. I have attached a small example of this.

    I hope this information helps. I will be glad to assist you further.


    Kind regards,
    Dessy
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. Toby Carter
    Toby Carter avatar
    3 posts
    Member since:
    Oct 2009

    Posted 17 Mar 2010 Link to this post

    I don't mean to dredge up an old topic, but I am in the middle of creating a chart requiring this exact functionality (it is basically a sparkline, with values above a specific baseline one color, and below that baseline another). The logic to create individual series to make this happen is pretty unruly. Is there any chance that this functionality could be implemented in a future release?
  4. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 19 Mar 2010 Link to this post

    Hello Toby Carter,

    I am afraid this is not in our plans at the moment. I can suggest an alternative approach -- use two line series and populate them with the same data. Then loop through all the ChartSeriesItems (or wire ItemDataBound event) and set the Empty property to true for all the points above the threshold for the first series and for all the points below that threshold for the second series. Still, there is a limitation -- you need to have a ChartSeriesItem at every point where the line goes above or below the threshold. You can find attached a small example.

    Kind regards,
    Ves
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. ciskomisko
    ciskomisko avatar
    8 posts
    Member since:
    Dec 2006

    Posted 20 Mar 2010 Link to this post

    Hi,All

    I have do that task perfectly you can check attached code. and see a screenshot.
    and below code.

     

    <div style="width: 100%;height:560px;overflow-y:auto;overflow-x:none" id="divLastDayChart" align="center">

     

     

    <telerik:RadChart ID="chartWidget" runat="server" Height="150" Width="1400" Skin="Office2007">

     

     

    <PlotArea YAxis-Visible="false" XAxis-LayoutMode="Inside" >

     

     

    <Appearance FillStyle-MainColor="white">

     

     

    </Appearance>

     

     

    <XAxis MaxValue="10" MinValue="1" Step="10" AutoScale="false" Appearance-PenStyle="Solid"

     

     

    Appearance-Width="0">

     

     

    <Appearance>

     

     

    <TextAppearance>

     

     

    </TextAppearance>

     

     

    </Appearance>

     

     

    <AxisLabel TextBlock-Text="20">

     

     

    </AxisLabel>

     

     

    <Items>

     

     

    </Items>

     

     

    </XAxis>

     

     

    <YAxis AutoScale="false" MinValue="0" MaxValue="10" Step="1">

     

     

    </YAxis>

     

     

    </PlotArea>

     

     

    <Legend Visible="false"></Legend>

     

     

    <ChartTitle Appearance-Position-AlignedPosition="Top" Appearance-Dimensions-Margins="0"

     

     

    Visible="false">

     

     

    </ChartTitle>

     

     

    </telerik:RadChart>

     

     

    </div>

     




    Private

     

    Sub DrawLineChart(Optional ByVal DateAndTime As DateTime = Nothing)

     

     

    Dim StationFrom As String = String.Empty

     

     

    Dim StationTo As String = String.Empty

     

     

    Dim objLine As New clsT_LinesDAL()

     

     

    Dim isSingleLine As Boolean = False

     

     

    Dim isFirstLine As Boolean = True

     

     

    Dim dtBranch As DataTable = objLine.GetLineBranches(CType(ParameterValue, Decimal), False).Tables(0)

     

    dtBranch = processDataTable(dtBranch)

     

    If dtBranch.Rows.Count = 1 Then

     

    isSingleLine =

    True

     

     

    End If

     

     

    Dim objLineWidgetDAL As New clsLineWidgetDAL()

     

     

    Dim dt As DataTable = objLineWidgetDAL.GetGetBackupLine(CType(ParameterValue, Decimal), DateAndTime)

     

     

    StationFrom =

    "NOVARA" ' dt.Rows(0).Item("Station_Name_From").ToString()

     

    StationTo =

    "Valmadonna" 'dt.Rows(0).Item("Station_Name_To").ToString()

     

     

    If clsGeneral.HasRows(dt) Then

     

    StationFrom = dt.Rows(0).Item(

    "Station_Name_From").ToString()

     

    StationTo = dt.Rows(0).Item(

    "Station_Name_To").ToString()

     

     

    End If

     

     

    ' chartWidget.ChartTitle.TextBlock.Text = PageTitle

     

     

    Me.chartWidget.Series.Clear()

     

     

    Me.chartWidget.Series.ClearItems()

     

    chartWidget.PlotArea.XAxis.Items.Clear()

    chartWidget.PlotArea.YAxis.Items.Clear()

    chartWidget.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = Color.Black

    chartWidget.Appearance.Corners.RoundSize = 5

    chartWidget.Appearance.Corners.TopLeft = Styles.CornerType.Round

    chartWidget.Appearance.Corners.TopRight = Styles.CornerType.Round

    chartWidget.Appearance.Corners.BottomLeft = Styles.CornerType.Round

    chartWidget.Appearance.Corners.BottomRight = Styles.CornerType.Round

    chartWidget.Appearance.Border.Color = Color.DarkGreen

     

    Dim branchy As Double = 0

     

     

    Dim positiontop As Double = 0

     

     

    Dim branchstarty As Double = 0

     

     

    Dim branchytalLinked As Double = 0

     

     

     

    If Not isSingleLine Then

     

    branchy = 2.5

    branchstarty = 2.5

    branchytalLinked = 2.5

    chartWidget.PlotArea.YAxis.MaxValue = (4 * dtBranch.Rows.Count)

    chartWidget.Height = 90 * dtBranch.Rows.Count

     

    Else

     

    chartWidget.PlotArea.YAxis.MaxValue = 5

    chartWidget.PlotArea.YAxis.Step = 1

    branchy = 2.3

    positiontop = 5

    branchstarty = 2.3

    branchytalLinked = 2.3

     

    End If

     

     

    Dim flgisconnected As Boolean = False

     

     

     

    Dim dtNodes As DataTable = New DataTable()

     

     

    Dim dtNodesMainLine As DataTable = New DataTable()

     

     

    For Each drbranch As DataRow In dtBranch.Rows

     

     

    If drbranch("Branches").ToString() <> "1" Then

     

    flgisconnected = Convert.ToBoolean(IIf(drbranch(

    "isBranchConnected").Equals(DBNull.Value), False, drbranch("isBranchConnected")))

     

     

    End If

     

     

    Dim k As Int16 = 0

     

    dtNodes = objLineWidgetDAL.GetLineNodesBranch(

    CType(ParameterValue, Decimal), Convert.ToInt32(drbranch("Branches")), DateAndTime)

     

     

    ''Check First This If Flag Connected=True.

     

     

    If flgisconnected AndAlso (Not isFirstLine) Then

     

     

    ''Get a Status Link With Main Line.

     

    dtNodesMainLine = objLineWidgetDAL.GetLineNodesBranch(

    CType(ParameterValue, Decimal), 1, DateAndTime)

     

     

    ''select a stationIndex.

     

     

    Dim drarr As DataRow() = dtNodesMainLine.Select("StationID=" & dtNodes.Rows(0)("StationID") & "")

     

     

    If drarr.Length > 0 Then

     

    k = dtNodesMainLine.Rows.IndexOf(drarr(0))

    branchytalLinked = branchytalLinked + 3

    branchy = branchy + 3

     

    Else

     

    branchy = branchy + 5

     

    End If

     

     

    Else

     

     

    If Not isFirstLine Then

     

    branchy = branchy + 5

     

    End If

     

     

    End If

     

     

     

    For j As Int32 = 0 To dtNodes.Rows.Count - 1

     

     

    Dim series3 As New ChartSeries()

     

    series3.Type = ChartSeriesType.Point

    series3.Appearance.Shadow.Blur = 3

    series3.Appearance.Shadow.Distance = 2

    series3.Appearance.Shadow.Color = Color.Gray

    series3.Appearance.PointMark.Visible =

    True

     

    series3.Appearance.PointShape =

    "Rectangle"

     

    series3.Appearance.PointDimentions.Width = 10

    series3.Appearance.PointDimentions.Height = 13

    series3.Appearance.PointDimentions.AutoSize =

    False

     

    series3.Appearance.Border.Visible =

    False

     

    series3.Appearance.FillStyle.FillType = Styles.FillType.Solid

    series3.Name =

    "Device_" & dtNodes.Rows(j)("station").ToString()

     

     

    If dtNodes.Rows(j)("StationDeviceStatus").ToString = "99" Then

     

    series3.Appearance.FillStyle.MainColor = System.Drawing.Color.LightGray

    series3.Appearance.FillStyle.SecondColor = System.Drawing.Color.LightGray

     

    ElseIf dtNodes.Rows(j)("StationDeviceStatus").ToString = "1" Then

     

    series3.Appearance.FillStyle.MainColor = System.Drawing.Color.Green

    series3.Appearance.FillStyle.SecondColor = System.Drawing.Color.Green

     

    ElseIf dtNodes.Rows(j)("StationDeviceStatus").ToString = "0" Then

     

    series3.Appearance.FillStyle.MainColor = System.Drawing.Color.Red

    series3.Appearance.FillStyle.SecondColor = System.Drawing.Color.Red

     

    End If

     

     

     

     

    Dim DeviceSeriesItem1 As New ChartSeriesItem(branchy, dtNodes.Rows(j)("station").ToString())

     

    DeviceSeriesItem1.XValue = j

    DeviceSeriesItem1.Name =

    "DeviceItem" + j.ToString()

     

    DeviceSeriesItem1.Label.Appearance.Visible =

    True

     

    DeviceSeriesItem1.Label.TextBlock.Appearance.TextProperties.Color = Color.Black

    DeviceSeriesItem1.Label.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Bottom

    DeviceSeriesItem1.Label.Appearance.LabelLocation = Styles.StyleSeriesItemLabel.ItemLabelLocation.Outside

    DeviceSeriesItem1.Label.TextBlock.Appearance.TextProperties.Font =

    New Font("Arial", 11, FontStyle.Regular, GraphicsUnit.Pixel)

     

     

    If j Mod 2 = 0 Then

     

    DeviceSeriesItem1.Label.Appearance.Dimensions.Margins.Top = 22 + positiontop

     

    Else

     

    DeviceSeriesItem1.Label.Appearance.Dimensions.Margins.Top = 5

     

    End If

     

    DeviceSeriesItem1.ActiveRegion.Tooltip = dtNodes.Rows(j)(

    "StationDeviceTolltip").ToString().Replace("<br>", vbNewLine)

     

     

    If flgisconnected Then

     

    DeviceSeriesItem1.XValue = k

     

    If j <> 0 Then

     

    series3.AddItem(DeviceSeriesItem1)

    chartWidget.Series.Add(series3)

     

    End If

     

     

    Else

     

    series3.AddItem(DeviceSeriesItem1)

    chartWidget.Series.Add(series3)

     

    End If

     

     

    Dim series4 As New ChartSeries()

     

    series4.Appearance.LineSeriesAppearance.Width = 4

    series4.Type = ChartSeriesType.Line

    series4.Appearance.Shadow.Blur = 3

    series4.Appearance.Shadow.Distance = 2

    series4.Appearance.Shadow.Color = Color.Gray

    series4.Appearance.PointMark.Visible =

    True

     

    series4.Appearance.Border.Visible =

    True

     

    series4.Appearance.FillStyle.FillType = Styles.FillType.Solid

     

    If dtNodes.Rows(j)("sequence").ToString = "1" Then

     

    series4.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.FromArgb(0, 190, 0)

     

    ElseIf dtNodes.Rows(j)("sequence").ToString = "2" Then

     

    series4.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.Blue

     

    Else

     

    series4.Appearance.LineSeriesAppearance.Color = Drawing.Color.Red

     

    End If

     

    series4.Name = dtNodes.Rows(j)(

    "station").ToString()

     

     

    'chartWidget.PlotArea.XAxis.AddItem(dtNodes.Rows(i)("station").ToString)

     

     

    'Split by space station name if more the 16 character

     

     

    Dim stationName1 As String = dtNodes.Rows(j)("station").ToString

     

    stationName1 = GetStatationName(stationName1)

     

    Dim chm1 As New ChartAxisItem("")

     

    chm1.TextBlock.Appearance.TextProperties.Font =

    New Font("Arial", 11, FontStyle.Regular, GraphicsUnit.Pixel)

     

     

    'If j Mod 2 = 0 Then

     

     

    ' 'chm.TextBlock.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Top

     

     

    ' ' chm1.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Bottom

     

     

    ' chm1.Appearance.Dimensions.Margins.Top = -70

     

     

    'Else

     

     

    ' ' chm1.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Center

     

     

    ' chm1.Appearance.Dimensions.Margins.Top = -80

     

     

    'End If

     

     

    ' chm1.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Center

     

    chm1.Appearance.Visible =

    False

     

    chm1.Value = j

     

    'If Not (j = 0 Or j = dtNodes.Rows.Count - 1) Then

     

     

    ' If Convert.ToInt32(dtNodes.Rows(j)("importanceID")) <= 2 Then

     

     

    ' chm1.Appearance.Visible = False

     

     

    ' End If

     

     

    'End If

     

     

    If isFirstLine Then

     

    chartWidget.PlotArea.XAxis.AddItem(chm1)

     

    End If

     

     

     

    Dim seriesItem1 As New ChartSeriesItem(branchy + 0.7)

     

    seriesItem1.XValue = j

    seriesItem1.Name =

    "Item" + j.ToString()

     

    seriesItem1.PointAppearance.Figure = Telerik.Charting.Styles.DefaultFigures.Circle

    seriesItem1.PointAppearance.FillStyle.FillType = Styles.FillType.Solid

    seriesItem1.PointAppearance.Dimensions.AutoSize =

    False

     

    seriesItem1.PointAppearance.Dimensions.Width = 10

    seriesItem1.PointAppearance.Dimensions.Height = 10

    seriesItem1.Label.Appearance.Visible =

    False

     

    seriesItem1.PointAppearance.Shadow.Blur = 3

    seriesItem1.PointAppearance.Shadow.Distance = 2

    seriesItem1.PointAppearance.Shadow.Color = Color.Gray

    seriesItem1.ActiveRegion.Tooltip = dtNodes.Rows(j)(

    "StationImportance").ToString().Replace("<br>", vbNewLine)

     

     

    If dtNodes.Rows(j)("status").ToString = "1" Then

     

    seriesItem1.PointAppearance.FillStyle.MainColor = System.Drawing.Color.FromArgb(0, 150, 0)

     

    ElseIf dtNodes.Rows(j)("status").ToString = "2" Then

     

    seriesItem1.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Blue

     

    Else

     

    seriesItem1.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Red

     

    End If

     

     

    If flgisconnected Then

     

     

    If j <> 0 Then

     

    seriesItem1.XValue = k

    series4.AddItem(seriesItem1)

     

    Else

     

     

    Dim seriesItemNew2 As ChartSeriesItem = New ChartSeriesItem()

     

     

    Dim seriesItemNew3 As ChartSeriesItem = New ChartSeriesItem()

     

    seriesItemNew3.XValue = k

    seriesItemNew3.YValue = branchstarty + 0.9

    seriesItemNew3.Label.Appearance.Visible =

    False

     

    series4.AddItem(seriesItemNew3)

    seriesItem1.XValue = k

     

    ''seriesItem1.YValue = branchy + 0.7 ''

     

    seriesItem1.PointAppearance.Dimensions.Width = 0

    seriesItem1.PointAppearance.Dimensions.Height = 0

    series4.AddItem(seriesItem1)

     

    End If

     

     

    Else

     

    series4.AddItem(seriesItem1)

     

    End If

     

     

     

     

     

     

    If (j < dtNodes.Rows.Count - 1) Then

     

     

    Dim seriesItem2 As New ChartSeriesItem(branchy + 0.7)

     

    seriesItem2.XValue = j + 1

    seriesItem2.Name =

    "Item" + j.ToString()

     

    seriesItem2.PointAppearance.Figure = Telerik.Charting.Styles.DefaultFigures.Circle

    seriesItem2.PointAppearance.FillStyle.FillType = Styles.FillType.Solid

    seriesItem2.PointAppearance.Dimensions.AutoSize =

    False

     

    seriesItem2.PointAppearance.Dimensions.Width = 10

    seriesItem2.PointAppearance.Dimensions.Height = 10

    seriesItem2.Label.Appearance.Visible =

    False

     

    seriesItem2.PointAppearance.Shadow.Blur = 3

    seriesItem2.PointAppearance.Shadow.Distance = 2

    seriesItem2.PointAppearance.Shadow.Color = Color.Gray

    seriesItem2.ActiveRegion.Tooltip = dtNodes.Rows(j)(

    "StationImportance").ToString().Replace("<br>", vbNewLine)

     

     

    If dtNodes.Rows(j + 1)("status").ToString = "1" Then

     

    seriesItem2.PointAppearance.FillStyle.MainColor = System.Drawing.Color.FromArgb(0, 150, 0)

     

    ElseIf dtNodes.Rows(j)("status").ToString = "2" Then

     

    seriesItem2.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Blue

     

    Else

     

    seriesItem2.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Red

     

    End If

     

     

    If flgisconnected Then

     

    seriesItem2.XValue = k + 1

    series4.AddItem(seriesItem2)

     

    Else

     

    series4.AddItem(seriesItem2)

     

    End If

     

     

    End If

     

    chartWidget.Series.Add(series4)

    k = k + 1

     

    Next

     

     

    ' branchy = branchy + 5

     

    isFirstLine =

    False

     

     

    Next

     

     

     

    '===============================

     

    branchytalLinked = branchytalLinked + 1

    dtNodes = dtNodesMainLine

     

    For j As Int32 = 0 To dtNodes.Rows.Count - 1

     

     

    If StationFrom <> String.Empty Or StationTo <> String.Empty Then

     

     

    If dtNodes.Rows(j)("station").ToString().ToLower() = StationFrom.ToString().ToLower() Then

     

     

    Dim seriesNew As New ChartSeries()

     

    seriesNew.Appearance.LineSeriesAppearance.Width = 3

    seriesNew.Type = ChartSeriesType.Line

    seriesNew.Appearance.LineSeriesAppearance.PenStyle = Drawing2D.DashStyle.Solid

    seriesNew.Appearance.Shadow.Blur = 2

    seriesNew.Appearance.Shadow.Distance = 3

    seriesNew.Appearance.Shadow.Color = Color.Gray

     

    Dim seriesItemNew1 As ChartSeriesItem = New ChartSeriesItem()

     

     

    Dim seriesItemNew2 As ChartSeriesItem = New ChartSeriesItem()

     

     

    Dim seriesItemNew3 As ChartSeriesItem = New ChartSeriesItem()

     

    seriesItemNew3.XValue = j

    seriesItemNew3.YValue = branchstarty + 0.9

    seriesItemNew3.Label.Appearance.Visible =

    False

     

    seriesItemNew2.XValue = j

    seriesItemNew2.YValue = ((branchytalLinked) + 0.5)

    seriesItemNew2.Label.Appearance.Visible =

    False

     

     

    seriesNew.AddItem(seriesItemNew2)

    seriesNew.AddItem(seriesItemNew3)

     

    'If Convert.ToDecimal(dt.Rows(0).Item("link_status")) = 0 Then

     

     

    ' seriesNew.Appearance.LineSeriesAppearance.Color = Drawing.Color.Red

     

     

    ' Else

     

    seriesNew.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.FromArgb(0, 190, 0)

     

    ' End If

     

    chartWidget.Series.Add(seriesNew)

     

    ElseIf dtNodes.Rows(j)("station").ToString().ToLower() = StationTo.ToString().ToLower() AndAlso Not chartWidget.GetSeries(StationFrom.ToString()) Is Nothing Then

     

     

    Dim seriesItem10 As ChartSeriesItem = chartWidget.GetSeries(StationFrom.ToString()).Item(0)

     

     

    Dim seriesNew As New ChartSeries()

     

    seriesNew.Appearance.LineSeriesAppearance.Width = 3

    seriesNew.Type = ChartSeriesType.Line

    seriesNew.Appearance.LineSeriesAppearance.PenStyle = Drawing2D.DashStyle.Solid

    seriesNew.Appearance.Shadow.Blur = 2

    seriesNew.Appearance.Shadow.Distance = 3

    seriesNew.Appearance.Shadow.Color = Color.Gray

     

    Dim seriesItemNew1 As ChartSeriesItem = New ChartSeriesItem()

     

     

    Dim seriesItemNew3 As ChartSeriesItem = New ChartSeriesItem()

     

     

    Dim seriesItemNew5 As ChartSeriesItem = New ChartSeriesItem()

     

     

    ''Start From Starting Position For the Use a LastSeries Item.Xvalue.

     

     

    ''YValue is Same as a Line position.

     

    seriesItemNew3.XValue = seriesItem10.XValue

    seriesItemNew3.YValue = ((branchytalLinked) + 0.5)

    seriesItemNew3.Label.Appearance.Visible =

    False

     

     

    ''Connect 3-1 with end of Xvalue= Maximum Value of StationIndex.

     

     

    'Same Y values as Line Position.

     

    seriesItemNew1.XValue = j

    seriesItemNew1.YValue = ((branchytalLinked) + 0.5)

    seriesItemNew1.Label.Appearance.Visible =

    False

     

     

    ''Coneect 1-5 But Now From Upper Right to Bottom at Line.

     

     

    'Xvalues in Maximum Value of StationIndex.

     

     

    'YValues is at a MainLine Drawn Points we save into variable branchstarty.

     

    seriesItemNew5.XValue = j

    seriesItemNew5.YValue = branchstarty + 0.9

    seriesItemNew5.Label.Appearance.Visible =

    False

     

    seriesNew.AddItem(seriesItemNew3)

    'add First 3

     

    seriesNew.AddItem(seriesItemNew1)

    'Connect 3-1

     

    seriesNew.AddItem(seriesItemNew5)

    'connect 1-5

     

     

    ' If Convert.ToDecimal(dt.Rows(0).Item("link_status")) = 0 Then

     

     

    'seriesNew.Appearance.LineSeriesAppearance.Color = Drawing.Color.Red

     

     

    ' Else

     

    seriesNew.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.FromArgb(0, 190, 0)

     

    ' End If

     

    chartWidget.Series.Add(seriesNew)

     

    End If

     

     

    End If

     

     

    Next

     

     

     

     

     

    ' ''dtNodes = objLineWidgetDAL.GetLineNodesBranch(CType(ParameterValue, Decimal), 2, DateAndTime)

     

     

    ' ''Dim k As Double = 5

     

     

    ' ''For j As Int32 = 0 To dtNodes.Rows.Count - 1

     

     

    ' '' Dim series3 As New ChartSeries()

     

     

    ' '' series3.Type = ChartSeriesType.Point

     

     

    ' '' series3.Appearance.Shadow.Blur = 3

     

     

    ' '' series3.Appearance.Shadow.Distance = 2

     

     

    ' '' series3.Appearance.Shadow.Color = Color.Gray

     

     

    ' '' series3.Appearance.PointMark.Visible = True

     

     

    ' '' series3.Appearance.PointShape = "Rectangle"

     

     

    ' '' series3.Appearance.PointDimentions.Width = 10

     

     

    ' '' series3.Appearance.PointDimentions.Height = 13

     

     

    ' '' series3.Appearance.PointDimentions.AutoSize = False

     

     

    ' '' series3.Appearance.Border.Visible = False

     

     

    ' '' series3.Appearance.FillStyle.FillType = Styles.FillType.Solid

     

     

    ' '' series3.Name = "Device_" & dtNodes.Rows(j)("station").ToString()

     

     

    ' '' If dtNodes.Rows(j)("StationDeviceStatus").ToString = "99" Then

     

     

    ' '' series3.Appearance.FillStyle.MainColor = System.Drawing.Color.LightGray

     

     

    ' '' series3.Appearance.FillStyle.SecondColor = System.Drawing.Color.LightGray

     

     

    ' '' ElseIf dtNodes.Rows(j)("StationDeviceStatus").ToString = "1" Then

     

     

    ' '' series3.Appearance.FillStyle.MainColor = System.Drawing.Color.Green

     

     

    ' '' series3.Appearance.FillStyle.SecondColor = System.Drawing.Color.Green

     

     

    ' '' ElseIf dtNodes.Rows(j)("StationDeviceStatus").ToString = "0" Then

     

     

    ' '' series3.Appearance.FillStyle.MainColor = System.Drawing.Color.Red

     

     

    ' '' series3.Appearance.FillStyle.SecondColor = System.Drawing.Color.Red

     

     

    ' '' End If

     

     

    ' '' ''Check For Series exists.

     

     

     

     

     

    ' '' Dim DeviceSeriesItem1 As New ChartSeriesItem(5.7, dtNodes.Rows(j)("station").ToString())

     

     

    ' '' DeviceSeriesItem1.XValue = k

     

     

    ' '' DeviceSeriesItem1.Name = "DeviceItem" + j.ToString()

     

     

    ' '' DeviceSeriesItem1.Label.Appearance.Visible = True

     

     

    ' '' DeviceSeriesItem1.Label.TextBlock.Appearance.TextProperties.Color = Color.Black

     

     

    ' '' DeviceSeriesItem1.Label.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Bottom

     

     

    ' '' DeviceSeriesItem1.Label.Appearance.LabelLocation = Styles.StyleSeriesItemLabel.ItemLabelLocation.Outside

     

     

    ' '' DeviceSeriesItem1.Label.TextBlock.Appearance.TextProperties.Font = New Font("Arial", 11, FontStyle.Regular, GraphicsUnit.Pixel)

     

     

    ' '' If j Mod 2 = 0 Then

     

     

    ' '' DeviceSeriesItem1.Label.Appearance.Dimensions.Margins.Top = 22 + positiontop

     

     

    ' '' Else

     

     

    ' '' DeviceSeriesItem1.Label.Appearance.Dimensions.Margins.Top = 5

     

     

    ' '' End If

     

     

    ' '' DeviceSeriesItem1.ActiveRegion.Tooltip = dtNodes.Rows(j)("StationDeviceTolltip").ToString().Replace("<br>", vbNewLine)

     

     

     

    ' '' 'If Not (j = 0 Or j = dtNodes.Rows.Count - 1) Then

     

     

    ' '' ' If Convert.ToInt32(dtNodes.Rows(j)("importanceID")) <= 2 Then

     

     

    ' '' ' DeviceSeriesItem1.Label.Appearance.Visible = False

     

     

    ' '' ' End If

     

     

    ' '' 'End If

     

     

    ' '' If j <> 0 Then

     

     

    ' '' series3.AddItem(DeviceSeriesItem1)

     

     

    ' '' chartWidget.Series.Add(series3)

     

     

    ' '' End If

     

     

    ' '' Dim series4 As New ChartSeries()

     

     

    ' '' series4.Appearance.LineSeriesAppearance.Width = 4

     

     

    ' '' series4.Type = ChartSeriesType.Line

     

     

    ' '' series4.Appearance.Shadow.Blur = 3

     

     

    ' '' series4.Appearance.Shadow.Distance = 2

     

     

    ' '' series4.Appearance.Shadow.Color = Color.Gray

     

     

    ' '' series4.Appearance.PointMark.Visible = True

     

     

    ' '' series4.Appearance.Border.Visible = True

     

     

    ' '' series4.Appearance.FillStyle.FillType = Styles.FillType.Solid

     

     

    ' '' If dtNodes.Rows(j)("sequence").ToString = "1" Then

     

     

    ' '' series4.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.FromArgb(0, 190, 0)

     

     

    ' '' ElseIf dtNodes.Rows(j)("sequence").ToString = "2" Then

     

     

    ' '' series4.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.Blue

     

     

    ' '' Else

     

     

    ' '' series4.Appearance.LineSeriesAppearance.Color = Drawing.Color.Red

     

     

    ' '' End If

     

     

    ' '' series4.Name = dtNodes.Rows(j)("station").ToString()

     

     

    ' '' 'chartWidget.PlotArea.XAxis.AddItem(dtNodes.Rows(i)("station").ToString)

     

     

    ' '' 'Split by space station name if more the 16 character

     

     

    ' '' Dim stationName1 As String = dtNodes.Rows(j)("station").ToString

     

     

    ' '' stationName1 = GetStatationName(stationName1)

     

     

    ' '' Dim chm1 As New ChartAxisItem("")

     

     

    ' '' chm1.TextBlock.Appearance.TextProperties.Font = New Font("Arial", 11, FontStyle.Regular, GraphicsUnit.Pixel)

     

     

    ' '' 'If j Mod 2 = 0 Then

     

     

    ' '' ' 'chm.TextBlock.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Top

     

     

    ' '' ' ' chm1.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Bottom

     

     

    ' '' ' chm1.Appearance.Dimensions.Margins.Top = -70

     

     

    ' '' 'Else

     

     

    ' '' ' ' chm1.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Center

     

     

    ' '' ' chm1.Appearance.Dimensions.Margins.Top = -80

     

     

    ' '' 'End If

     

     

    ' '' ' chm1.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Center

     

     

    ' '' chm1.Appearance.Visible = False

     

     

    ' '' chm1.Value = j

     

     

    ' '' 'If Not (j = 0 Or j = dtNodes.Rows.Count - 1) Then

     

     

    ' '' ' If Convert.ToInt32(dtNodes.Rows(j)("importanceID")) <= 2 Then

     

     

    ' '' ' chm1.Appearance.Visible = False

     

     

    ' '' ' End If

     

     

    ' '' 'End If

     

     

    ' '' 'If isFirstLine Then

     

     

    ' '' ' chartWidget.PlotArea.XAxis.AddItem(chm1)

     

     

    ' '' 'End If

     

     

     

    ' '' Dim seriesItem1 As New ChartSeriesItem(6.2)

     

     

    ' '' seriesItem1.XValue = k

     

     

    ' '' seriesItem1.Name = "Item" + j.ToString()

     

     

    ' '' seriesItem1.PointAppearance.Figure = Telerik.Charting.Styles.DefaultFigures.Circle

     

     

    ' '' seriesItem1.PointAppearance.FillStyle.FillType = Styles.FillType.Solid

     

     

    ' '' seriesItem1.PointAppearance.Dimensions.AutoSize = False

     

     

    ' '' seriesItem1.PointAppearance.Dimensions.Width = 10

     

     

    ' '' seriesItem1.PointAppearance.Dimensions.Height = 10

     

     

    ' '' seriesItem1.Label.Appearance.Visible = False

     

     

    ' '' seriesItem1.PointAppearance.Shadow.Blur = 3

     

     

    ' '' seriesItem1.PointAppearance.Shadow.Distance = 2

     

     

    ' '' seriesItem1.PointAppearance.Shadow.Color = Color.Gray

     

     

    ' '' seriesItem1.ActiveRegion.Tooltip = dtNodes.Rows(j)("StationImportance").ToString().Replace("<br>", vbNewLine)

     

     

    ' '' If dtNodes.Rows(j)("status").ToString = "1" Then

     

     

    ' '' seriesItem1.PointAppearance.FillStyle.MainColor = System.Drawing.Color.FromArgb(0, 150, 0)

     

     

    ' '' ElseIf dtNodes.Rows(j)("status").ToString = "2" Then

     

     

    ' '' seriesItem1.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Blue

     

     

    ' '' Else

     

     

    ' '' seriesItem1.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Red

     

     

    ' '' End If

     

     

    ' '' If j <> 0 Then

     

     

    ' '' series4.AddItem(seriesItem1)

     

     

    ' '' Else

     

     

     

    ' '' Dim seriesItemNew2 As ChartSeriesItem = New ChartSeriesItem()

     

     

    ' '' Dim seriesItemNew3 As ChartSeriesItem = New ChartSeriesItem()

     

     

    ' '' seriesItemNew3.XValue = k

     

     

    ' '' seriesItemNew3.YValue = 2.5 + 0.9

     

     

    ' '' seriesItemNew3.Label.Appearance.Visible = False

     

     

     

     

    ' '' seriesItemNew2.XValue = k

     

     

    ' '' seriesItemNew2.YValue = 6.2

     

     

    ' '' seriesItemNew2.Label.Appearance.Visible = False

     

     

    ' '' ' seriesNew.AddItem(seriesItemNew1)

     

     

    ' '' series4.AddItem(seriesItemNew2)

     

     

    ' '' series4.AddItem(seriesItemNew3)

     

     

     

    ' '' seriesItem1.PointAppearance.Dimensions.Width = 0

     

     

    ' '' seriesItem1.PointAppearance.Dimensions.Height = 0

     

     

    ' '' series4.AddItem(seriesItem1)

     

     

    ' '' End If

     

     

     

    ' '' If (j < dtNodes.Rows.Count - 1) Then

     

     

    ' '' Dim seriesItem2 As New ChartSeriesItem(6.2)

     

     

    ' '' seriesItem2.XValue = k + 1

     

     

    ' '' seriesItem2.Name = "Item" + j.ToString()

     

     

    ' '' seriesItem2.PointAppearance.Figure = Telerik.Charting.Styles.DefaultFigures.Circle

     

     

    ' '' seriesItem2.PointAppearance.FillStyle.FillType = Styles.FillType.Solid

     

     

    ' '' seriesItem2.PointAppearance.Dimensions.AutoSize = False

     

     

    ' '' seriesItem2.PointAppearance.Dimensions.Width = 10

     

     

    ' '' seriesItem2.PointAppearance.Dimensions.Height = 10

     

     

    ' '' seriesItem2.Label.Appearance.Visible = False

     

     

    ' '' seriesItem2.PointAppearance.Shadow.Blur = 3

     

     

    ' '' seriesItem2.PointAppearance.Shadow.Distance = 2

     

     

    ' '' seriesItem2.PointAppearance.Shadow.Color = Color.Gray

     

     

    ' '' seriesItem2.ActiveRegion.Tooltip = dtNodes.Rows(j)("StationImportance").ToString().Replace("<br>", vbNewLine)

     

     

    ' '' If dtNodes.Rows(j + 1)("status").ToString = "1" Then

     

     

    ' '' seriesItem2.PointAppearance.FillStyle.MainColor = System.Drawing.Color.FromArgb(0, 150, 0)

     

     

    ' '' ElseIf dtNodes.Rows(j)("status").ToString = "2" Then

     

     

    ' '' seriesItem2.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Blue

     

     

    ' '' Else

     

     

    ' '' seriesItem2.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Red

     

     

    ' '' End If

     

     

    ' '' series4.AddItem(seriesItem2)

     

     

    ' '' End If

     

     

    ' '' chartWidget.Series.Add(series4)

     

     

    ' '' k = k + 1

     

     

    ' ''Next

     

     

    ''''''''''''

     

     

    ''Dim dtNodes As DataTable = objLineWidgetDAL.GetLineNodesBranch(CType(ParameterValue, Decimal), 10, DateAndTime)

     

     

    ''branchy = 2.3

     

     

    ''For j As Int32 = 0 To dtNodes.Rows.Count - 1

     

     

    '' Dim series3 As New ChartSeries()

     

     

    '' series3.Type = ChartSeriesType.Point

     

     

    '' series3.Appearance.Shadow.Blur = 3

     

     

    '' series3.Appearance.Shadow.Distance = 2

     

     

    '' series3.Appearance.Shadow.Color = Color.Gray

     

     

    '' series3.Appearance.PointMark.Visible = True

     

     

    '' series3.Appearance.PointShape = "Rectangle"

     

     

    '' series3.Appearance.PointDimentions.Width = 10

     

     

    '' series3.Appearance.PointDimentions.Height = 13

     

     

    '' series3.Appearance.PointDimentions.AutoSize = False

     

     

    '' series3.Appearance.Border.Visible = False

     

     

    '' series3.Appearance.FillStyle.FillType = Styles.FillType.Solid

     

     

    '' series3.Name = "Device_" & dtNodes.Rows(j)("station").ToString()

     

     

    '' If dtNodes.Rows(j)("StationDeviceStatus").ToString = "99" Then

     

     

    '' series3.Appearance.FillStyle.MainColor = System.Drawing.Color.LightGray

     

     

    '' series3.Appearance.FillStyle.SecondColor = System.Drawing.Color.LightGray

     

     

    '' ElseIf dtNodes.Rows(j)("StationDeviceStatus").ToString = "1" Then

     

     

    '' series3.Appearance.FillStyle.MainColor = System.Drawing.Color.Green

     

     

    '' series3.Appearance.FillStyle.SecondColor = System.Drawing.Color.Green

     

     

    '' ElseIf dtNodes.Rows(j)("StationDeviceStatus").ToString = "0" Then

     

     

    '' series3.Appearance.FillStyle.MainColor = System.Drawing.Color.Red

     

     

    '' series3.Appearance.FillStyle.SecondColor = System.Drawing.Color.Red

     

     

    '' End If

     

     

     

     

    '' Dim DeviceSeriesItem1 As New ChartSeriesItem(branchy, dtNodes.Rows(j)("station").ToString())

     

     

    '' DeviceSeriesItem1.XValue = j

     

     

    '' DeviceSeriesItem1.Name = "DeviceItem" + j.ToString()

     

     

    '' DeviceSeriesItem1.Label.Appearance.Visible = True

     

     

    '' DeviceSeriesItem1.Label.TextBlock.Appearance.TextProperties.Color = Color.Black

     

     

    '' DeviceSeriesItem1.Label.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Bottom

     

     

    '' DeviceSeriesItem1.Label.Appearance.LabelLocation = Styles.StyleSeriesItemLabel.ItemLabelLocation.Outside

     

     

    '' If j Mod 2 = 0 Then

     

     

    '' DeviceSeriesItem1.Label.Appearance.Dimensions.Margins.Top = 10

     

     

    '' Else

     

     

    '' DeviceSeriesItem1.Label.Appearance.Dimensions.Margins.Top = 20

     

     

    '' End If

     

     

     

    '' DeviceSeriesItem1.ActiveRegion.Tooltip = dtNodes.Rows(j)("StationDeviceTolltip").ToString().Replace("<br>", vbNewLine)

     

     

    '' series3.AddItem(DeviceSeriesItem1)

     

     

    '' 'If Not (j = 0 Or j = dtNodes.Rows.Count - 1) Then

     

     

    '' ' If Convert.ToInt32(dtNodes.Rows(j)("importanceID")) <= 2 Then

     

     

    '' ' DeviceSeriesItem1.Label.Appearance.Visible = False

     

     

    '' ' End If

     

     

    '' 'End If

     

     

    '' chartWidget.Series.Add(series3)

     

     

    '' Dim series4 As New ChartSeries()

     

     

    '' series4.Appearance.LineSeriesAppearance.Width = 4

     

     

    '' series4.Type = ChartSeriesType.Line

     

     

    '' series4.Appearance.Shadow.Blur = 3

     

     

    '' series4.Appearance.Shadow.Distance = 2

     

     

    '' series4.Appearance.Shadow.Color = Color.Gray

     

     

    '' series4.Appearance.PointMark.Visible = True

     

     

    '' series4.Appearance.Border.Visible = False

     

     

    '' series4.Appearance.FillStyle.FillType = Styles.FillType.Solid

     

     

    '' If dtNodes.Rows(j)("sequence").ToString = "1" Then

     

     

    '' series4.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.FromArgb(0, 190, 0)

     

     

    '' ElseIf dtNodes.Rows(j)("sequence").ToString = "2" Then

     

     

    '' series4.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.Blue

     

     

    '' Else

     

     

    '' series4.Appearance.LineSeriesAppearance.Color = Drawing.Color.Red

     

     

    '' End If

     

     

    '' series4.Name = dtNodes.Rows(j)("station").ToString()

     

     

    '' 'chartWidget.PlotArea.XAxis.AddItem(dtNodes.Rows(i)("station").ToString)

     

     

    '' 'Split by space station name if more the 16 character

     

     

    '' Dim stationName1 As String = dtNodes.Rows(j)("station").ToString

     

     

    '' stationName1 = GetStatationName(stationName1)

     

     

    '' Dim chm1 As New ChartAxisItem("")

     

     

    '' chm1.TextBlock.Appearance.TextProperties.Font = New Font("Arial", 11, FontStyle.Regular, GraphicsUnit.Pixel)

     

     

    '' 'If j Mod 2 = 0 Then

     

     

    '' ' 'chm.TextBlock.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Top

     

     

    '' ' chm1.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Bottom

     

     

    '' ' chm1.Appearance.Dimensions.Margins.Top = -0

     

     

    '' 'Else

     

     

    '' ' chm1.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Center

     

     

    '' ' chm1.Appearance.Dimensions.Margins.Top = -0

     

     

    '' 'End If

     

     

    '' chm1.Appearance.Position.AlignedPosition = Styles.AlignedPositions.Center

     

     

    '' chm1.Appearance.Visible = False

     

     

    '' chm1.Appearance.Dimensions.Margins.Top = -80

     

     

    '' chm1.Value = j

     

     

    '' 'If Not (j = 0 Or j = dtNodes.Rows.Count - 1) Then

     

     

    '' ' If Convert.ToInt32(dtNodes.Rows(j)("importanceID")) <= 2 Then

     

     

    '' ' chm1.Appearance.Visible = False

     

     

    '' ' End If

     

     

    '' 'End If

     

     

     

    '' chartWidget.PlotArea.XAxis.AddItem(chm1)

     

     

     

     

    '' Dim seriesItem1 As New ChartSeriesItem(branchy + 0.7)

     

     

    '' seriesItem1.XValue = j

     

     

    '' seriesItem1.Name = "Item" + j.ToString()

     

     

    '' seriesItem1.PointAppearance.Figure = Telerik.Charting.Styles.DefaultFigures.Circle

     

     

    '' seriesItem1.PointAppearance.FillStyle.FillType = Styles.FillType.Solid

     

     

    '' seriesItem1.PointAppearance.Dimensions.AutoSize = False

     

     

    '' seriesItem1.PointAppearance.Dimensions.Width = 10

     

     

    '' seriesItem1.PointAppearance.Dimensions.Height = 10

     

     

    '' seriesItem1.Label.Appearance.Visible = False

     

     

    '' seriesItem1.PointAppearance.Shadow.Blur = 3

     

     

    '' seriesItem1.PointAppearance.Shadow.Distance = 2

     

     

    '' seriesItem1.PointAppearance.Shadow.Color = Color.Gray

     

     

    '' seriesItem1.ActiveRegion.Tooltip = dtNodes.Rows(j)("StationImportance").ToString().Replace("<br>", vbNewLine)

     

     

    '' If dtNodes.Rows(j)("status").ToString = "1" Then

     

     

    '' seriesItem1.PointAppearance.FillStyle.MainColor = System.Drawing.Color.FromArgb(0, 150, 0)

     

     

    '' ElseIf dtNodes.Rows(j)("status").ToString = "2" Then

     

     

    '' seriesItem1.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Blue

     

     

    '' Else

     

     

    '' seriesItem1.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Red

     

     

    '' End If

     

     

    '' series4.AddItem(seriesItem1)

     

     

    '' If (j < dtNodes.Rows.Count - 1) Then

     

     

    '' Dim seriesItem2 As New ChartSeriesItem(branchy + 0.7)

     

     

    '' seriesItem2.XValue = j + 1

     

     

    '' seriesItem2.Name = "Item" + j.ToString()

     

     

    '' seriesItem2.PointAppearance.Figure = Telerik.Charting.Styles.DefaultFigures.Circle

     

     

    '' seriesItem2.PointAppearance.FillStyle.FillType = Styles.FillType.Solid

     

     

    '' seriesItem2.PointAppearance.Dimensions.AutoSize = False

     

     

    '' seriesItem2.PointAppearance.Dimensions.Width = 10

     

     

    '' seriesItem2.PointAppearance.Dimensions.Height = 10

     

     

    '' seriesItem2.Label.Appearance.Visible = False

     

     

    '' seriesItem2.PointAppearance.Shadow.Blur = 3

     

     

    '' seriesItem2.PointAppearance.Shadow.Distance = 2

     

     

    '' seriesItem2.PointAppearance.Shadow.Color = Color.Gray

     

     

    '' seriesItem2.ActiveRegion.Tooltip = dtNodes.Rows(j)("StationImportance").ToString().Replace("<br>", vbNewLine)

     

     

    '' If dtNodes.Rows(j + 1)("status").ToString = "1" Then

     

     

    '' seriesItem2.PointAppearance.FillStyle.MainColor = System.Drawing.Color.FromArgb(0, 150, 0)

     

     

    '' ElseIf dtNodes.Rows(j)("status").ToString = "2" Then

     

     

    '' seriesItem2.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Blue

     

     

    '' Else

     

     

    '' seriesItem2.PointAppearance.FillStyle.MainColor = System.Drawing.Color.Red

     

     

    '' End If

     

     

    '' series4.AddItem(seriesItem2)

     

     

    '' End If

     

     

    '' chartWidget.Series.Add(series4)

     

     

    ''Next

     

     

     

    'DrawBackupLine(DateAndTime)

     

     

    End Sub

     

Back to Top