Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
850
Some questions about linechart...
posted

I everybody,

First of all, Let me talk about what I'm doing.

I add three series to the ultrachart ("Max" ,"Min" and "serial" series ones in the picture).

Max = red line

Min = Green line

serial = blue line

 

"Max" and "Min" series help us to see the behavior of our parameter to qualify for a period of time,
if it meets our specifications.
So, Here come the questions, I don't know if this it's posible to do:

How can I disable tooltips in the "Max" and "Min" series?
I mean, allow tooltips only in the "serial"  serie.


How can I change the line styles of the series?
I want to use Dash for the red and green series and solid for the blue serie.


How can I use Symbol Icon only in the blue serie?

I was looking some information about this but I have not had succes.

I hope somebody can help me.

This is my code.

Imports System.Data.SqlClient
Imports Infragistics.UltraChart.Resources.Appearance
Imports Infragistics.UltraChart.Shared.Styles
Imports Infragistics

Public Class Queries

    Private Sub MonthCalendar1_DateSelected(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateSelected
        UltraChart1.Series.Clear()
        Dim dSet As New DataSet
        dSet = getByDate(CDate(Format(MonthCalendar1.SelectionRange.Start, "yyyy-MM-dd")), CDate(Format(MonthCalendar1.SelectionRange.Start.AddDays(1), "yyyy-MM-dd")))
        If Not dSet.Tables(0).Rows.Count = 0 Then
            UltraGrid1.DataSource = dSet
            Dim serial As New NumericTimeSeries
            serial.Data.TimeValueColumn = dSet.Tables(0).Columns(0).ColumnName.ToString
            serial.Data.ValueColumn = dSet.Tables(0).Columns(3).ColumnName.ToString
            serial.Data.DataSource = dSet.Tables(0)
            serial.DataBind()
            serial.PEs.Add(New PaintElement(Color.Blue))
            UltraChart1.Series.Add(serial)
            CustomUltraChart()
            AddSpecificationQualityLine(dSet)
        End If
        UltraChart1.EmptyChartText = "No existen datos a graficar. Seleccione otra fecha"
    End Sub

    Function getByDate(ByVal querydate1, ByVal querydate2) As DataSet
        Dim objConnection As New Connection
        Dim conn As New SqlConnection
        Dim adapter As New SqlDataAdapter
        Dim cmd As SqlCommand
        Dim dSet As New DataSet
        conn = objConnection.ConnectToDB2()
        cmd = New SqlCommand("QueriesKF", conn)
        adapter.SelectCommand = cmd
        adapter.SelectCommand.CommandType = CommandType.StoredProcedure
        objConnection.AddParam(adapter, SqlDbType.DateTime, ParameterDirection.Input, "@DateQuery1", querydate1)
        objConnection.AddParam(adapter, SqlDbType.DateTime, ParameterDirection.Input, "@DateQuery2", querydate2)
        adapter.Fill(dSet)
        Return dSet
    End Function

    Private Sub CustomUltraChart()
        UltraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.LineChart
        UltraChart1.Axis.Y.RangeType = AxisRangeType.Custom
        UltraChart1.Axis.Y.RangeMax = 12
        UltraChart1.Axis.Y.RangeMin = 7
        UltraChart1.Axis.Y.TickmarkStyle = AxisTickStyle.DataInterval
        UltraChart1.Axis.Y.TickmarkInterval = 1.5

        UltraChart1.LineChart.TreatDateTimeAsString = False
        UltraChart1.Axis.X.TickmarkIntervalType = AxisIntervalType.Days
        UltraChart1.Axis.X.TickmarkStyle = AxisTickStyle.DataInterval
        UltraChart1.Axis.X.TimeAxisStyle.TimeAxisStyle = RulerGenre.Discrete
        'UltraChart1.Axis.X.Labels.ItemFormatString = "<ITEM_LABEL:MM/dd/yyyy hh:mm:ss>"
    End Sub


    Private Sub AddSpecificationQualityLine(ByVal ds As DataSet)
        Dim Max As New NumericTimeSeries()
        Max.PEs.Add(New PaintElement(Color.Red))
        Dim Min As New NumericTimeSeries()
        Min.PEs.Add(New PaintElement(Color.Green))

        For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
            Max.Points.Add(New NumericTimeDataPoint(ds.Tables(0).Rows(i)(0), 9.2, "", False))
            Min.Points.Add(New NumericTimeDataPoint(ds.Tables(0).Rows(i)(0), 10.5, "", False))
        Next

        UltraChart1.Series.Add(Max)
        UltraChart1.Series.Add(Min)

 
    End Sub

End Class

 

By the way, I was using target line example to do this but I had to leave it because it doesn´t work properly in my results and what I expect when I set changes in the specifications (Max and Min Series).

 

  • 850
    posted

    No, thanks,

    I'm using  LineAppearances property and it's working properly.

    thanks for your recommendations

    Best regads...

  • 26458
    Offline posted

    I recommend using a composite chart for this, although it's still possible to do most of these things for a non-composite chart.

    First of all, out of the box, the tooltips can't be displayed selectively for a certain line. The tooltips are defined for the entire chart, so you would have to play with the main tooltip's visibility and format string for this.

    Look at the chart.LineChart.LineAppearances property. Here you can add anumber of appearances, one per line. Each appearance will allow you to modify dash style and the symbol. These line appearances are applied in order. Meaning, that the first line gets the first appearance, and so on. Composite charts will allow you to set the appearance  for specific line layers, if you decide to go the composite chart route.