Gauges - YAxis
« on: April 15, 2016, 03:25:44 PM »
So my code is below.
1) no matter what value I change the YAxisDividers to, I get 10. Which causes me to get really, screwy divisions.
2) I'm using it for a progress type bar, so I could have no numbers, but I can't figure out how to make them go away.
3) I;ld like to make the gauge bigger within the chart boarders...
4) ... how do I make it move.... I can set it equal to a Datagridview, or I can add a series, but is the but is the only way to make it move to create a datagridview and then change the value?

Any help is appreciated.

 With CC_Open_Calibration
            .Title = "Loading Calibration"
            .Style = STYLE2D3D.STYLE2D_GAUGE
            .BackStyle = STYLEBACKGROUND.STYLEBACKGROUND_SOLID
            .BackColor = Color.White
            .Series = sf.Series
            ' Datatable setup
            .ShowDataTable = False
            .ShowLegend = False
            ' Scale setup
            .YAxisScaleMode = SCALEMODE.SCALEMODE_FIXED
            .YAxisScaleMinimum = 0
            .YAxisScaleMaximum = 100
            .YAxisNumericFormat = "0"
            .YAxisDividersCount = 8
            .YAxisNumericFormat = "F0"
            .ValuesLocationStyle = STYLECAPTIONLOCATION.STYLECAPTIONLOCATION_SMART_PLACEMENT
            ' Gauge setup
            .GaugeBackStyle = New SolidBrush() {New SolidBrush(Color.White)}
            .GaugeBorderStyle = New Pen() {New Pen(Color.DarkBlue, 3)}
            .GaugeBigTickStyle = New Pen() {New Pen(Color.DarkBlue, 2)}
            .GaugeSmallTickStyle = New Pen() {New Pen(Color.LightBlue, 1)}
            .GaugeCentralCircleBackStyle = New SolidBrush() {New SolidBrush(Color.Black)}
            .GaugeCentralCircleRadius = {0.1}
            .ShowValues = False
            .ShowYAxis = False
            .ShowXAxis = False
            ' Needle style
            Dim p As Pen = New Pen(Color.Black, 6)
            p.EndCap = Drawing2D.LineCap.Triangle
            .GaugeNeedleStyle = New Pen() {p}
            ' Range colors
            'Dim rangeColors(0) As ArrayList
            'rangeColors(0) = New ArrayList
            'rangeColors(0).Add(New Object() {0, 30, Color.FromArgb(200, Color.Red)})
            'rangeColors(0).Add(New Object() {30, 50, Color.FromArgb(200, Color.Green)})
            'rangeColors(0).Add(New Object() {50, 100, Color.FromArgb(200, Color.Yellow)})
            '.GaugeRangeColors = rangeColors
            .RefreshChart()
end with
« Last Edit: April 15, 2016, 04:45:05 PM by SykedSoftware »

Re: Gauges - YAxis
« Reply #1 on: April 18, 2016, 12:46:46 AM »
Thanks for sharing your code. We're looking into this.

Re: Gauges - YAxis
« Reply #2 on: April 18, 2016, 11:19:04 AM »
Hi!

We're releasing an update so numbes in the gauges can be removed (just using ShowYAxis = false).

1) We've changed the YAxisDividersCount to several values and the number of big ticks changes accordingly. Try the new update just in case.
2) It's possible with the new update.
3) Use GaugeMarginFactor property (set it to zero to reduce gap to the minimum - also set chart maginLeft, Bottom, Right, Top to zero)
4) To move the needles you just need to update the Series property, so in addition to the new values, some internal calculations are ensured. Check out the sample code below which uses a timer to increment the needles by a factor of 1.


Code: [Select]
Imports CrossingChartsLibrary

Public Class Form1

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        With CC_Open_Calibration
            .Title = "Loading Calibration"
            .Style = STYLE2D3D.STYLE2D_GAUGE
            .BackStyle = STYLEBACKGROUND.STYLEBACKGROUND_SOLID
            .BackColor = Color.White

            ' Datatable & legend setup
            .ShowDataTable = False
            .ShowLegend = False

            ' Scale setup
            .YAxisScaleMode = SCALEMODE.SCALEMODE_FIXED
            .YAxisScaleMinimum = 0
            .YAxisScaleMaximum = 100
            .YAxisNumericFormat = "0"
            .YAxisDividersCount = 20

            ' Gauge setup
            .GaugeBackStyle = New SolidBrush() {New SolidBrush(Color.White)}
            .GaugeBorderStyle = New Pen() {New Pen(Color.DarkBlue, 3)}
            .GaugeBigTickStyle = New Pen() {New Pen(Color.DarkBlue, 2)}
            .GaugeSmallTickStyle = New Pen() {New Pen(Color.LightBlue, 1)}
            .GaugeCentralCircleBackStyle = New SolidBrush() {New SolidBrush(Color.Black)}
            .GaugeCentralCircleRadius = {0.1}
            .GaugeMarginFactor = 0.02
            .ShowYAxis = False

            ' Needle style
            Dim p As Pen = New Pen(Color.Black, 6)
            p.EndCap = Drawing2D.LineCap.Triangle
            .GaugeNeedleStyle = New Pen() {p}
            .GaugeBackStyle = New SolidBrush() {New SolidBrush(Color.White), New SolidBrush(Color.White)}
            .GaugeBigTickStyle = New Pen() {New Pen(Color.Black), New Pen(Color.Blue)}
            .SampleData(2, 1, 0, 100)
            .RefreshChart()
        End With
    End Sub

    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        Dim data As ArrayList() = CC_Open_Calibration.Series

        ' Each gauge corresponds to a serie. First gauge is serie 0, second gauge is serie 1
        ' And each serie can have one or more values (each value would be a needle - in this example, only one needle for each gauge)
        Dim gauge1 As Single = data(0)(0)
        gauge1 += 1
        If (gauge1 > 100) Then gauge1 = 0
        data(0)(0) = gauge1

        Dim gauge2 As Single = data(1)(0)
        gauge2 += 1
        If (gauge2 > 100) Then gauge2 = 0
        data(1)(0) = gauge2

        ' Update data
        CC_Open_Calibration.Series = data
        CC_Open_Calibration.RefreshChart()


    End Sub
End Class