Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Can you try just the data bindings for the Y and X values without the rest of the code?
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 12 Years Ago
Posts: 2,
Visits: 1
|
Thanks, i guess i should have tried harder to figure that out... I have modified the code a little based on the datetimescale example, my datetime code looks like this -
' create a date time scale Dim m_DateTimeScale As NDateTimeScaleConfigurator = New NDateTimeScaleConfigurator() Dim dateTimeScale As NDateTimeScaleConfigurator = New NDateTimeScaleConfigurator() Dim dateTimeUnits As ArrayList = New ArrayList() dateTimeUnits.Add(NDateTimeUnit.Millisecond) dateTimeUnits.Add(NDateTimeUnit.Second) dateTimeUnits.Add(NDateTimeUnit.Minute) dateTimeUnits.Add(NDateTimeUnit.Hour) dateTimeUnits.Add(NDateTimeUnit.Day) dateTimeUnits.Add(NDateTimeUnit.Week) dateTimeUnits.Add(NDateTimeUnit.Month) dateTimeUnits.Add(NDateTimeUnit.Year)
Dim autoUnits As NDateTimeUnit() = New NDateTimeUnit(dateTimeUnits.Count - 1) {} Dim i As Integer = 0 Do While i < autoUnits.Length autoUnits(i) = CType(dateTimeUnits(i), NDateTimeUnit) i += 1 Loop
m_DateTimeScale.EnableUnitSensitiveFormatting = True
m_DateTimeScale.AutoDateTimeUnits = autoUnits
'' m_DateTimeScale = dateTimeScale m_DateTimeScale.LabelStyle.Angle = New NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90) m_DateTimeScale.LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft m_chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale
Then i added the line - dataBindingManager.AddBinding(0, 0, "XValues", myData, "date")
when i run the code with the line dataBindingManager.AddBinding(0, 0, "XValues", myData, "date") i get an error;
The CLR has been unable to transition from COM context 0x5631d0 to COM context 0x563340 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.
I have no idea what this means
When i run the code with the line commented out it all works fine(i guess this proves the rest of the code is good)
my timedate format is %d/%m/%Y %T.%f
|
Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi Andy, Regarding your request: >> the problem is I don't know how to tell the databindingmanager to add the 'date' column of the datasource and use it as the yaxis You are probably referring to the X axis, because in the source code it is the one with DateTime scale. Anyway, you bind the Y values with the following code: dataBindingManager.AddBinding(0, 0, "Values", myData, "l1_volts") and you can have the same thing for the XValues data series: dataBindingManager.AddBinding(0, 0, "XValues", myData, "date") In general, each data series should be bound to a column in the data source with a separate call to AddBinding.
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 12 Years Ago
Posts: 2,
Visits: 1
|
Hi All, I have a MySQL database which will be loaded with info and i wish to display this as a sampled Line with multiple series.
Its almost working...
Using the examples I have created a Sampled Line Graph that successfully displays data from mySQL database, however its displaying the number of record on the Yaxis. So I took some code from the datetimescale example, the problem is I don't know how to tell the databindingmanager to add the 'date' column of the datasource and use it as the yaxis ? Below is the code i am using
' set a chart title Dim title As NLabel = NChartControl1.Labels.AddHeader("Date Time Scale") title.TextStyle.TextFormat = TextFormat.XML title.TextStyle.FontStyle = New NFontStyle("Times New Roman", 18, FontStyle.Italic) title.ContentAlignment = ContentAlignment.BottomCenter title.Location = New NPointL(New NLength(50, NRelativeUnit.ParentPercentage), New NLength(2, NRelativeUnit.ParentPercentage))
' no legend NChartControl1.Legends.Clear()
' Add a line series Dim m_chart As NChart = NChartControl1.Charts(0) Dim m_Line As NLineSeries = CType(m_chart.Series.Add(SeriesType.Line), NLineSeries)
'm_Line = CType(m_Chart.Series.Add(SeriesType.Line), NLineSeries) m_Line.Name = "Line Series" m_Line.InflateMargins = True m_Line.DataLabelStyle.Visible = True m_Line.MarkerStyle.Visible = True m_Line.MarkerStyle.BorderStyle.Color = Color.DarkRed m_Line.MarkerStyle.PointShape = PointShape.Cylinder m_Line.MarkerStyle.Width = New NLength(1.5F, NRelativeUnit.ParentPercentage) m_Line.MarkerStyle.Height = New NLength(1.5F, NRelativeUnit.ParentPercentage)
m_Line.SamplingMode = SeriesSamplingMode.Enabled m_Line.UseXValues = True
' create a date time scale Dim m_DateTimeScale As NDateTimeScaleConfigurator Dim dateTimeScale As NDateTimeScaleConfigurator = New NDateTimeScaleConfigurator()
m_DateTimeScale = dateTimeScale m_DateTimeScale.LabelStyle.Angle = New NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90) m_DateTimeScale.LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft m_chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale Dim xAxis As NAxis = m_chart.Axis(StandardAxis.PrimaryX) xAxis.ScrollBar.Visible = True
' add interlaced stripe to the Y axis Dim linearScale As NLinearScaleConfigurator = TryCast(m_chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator, NLinearScaleConfigurator) Dim stripStyle As NScaleStripStyle = New NScaleStripStyle(New NColorFillStyle(Color.Beige), Nothing, True, 0, 0, 1, 1) stripStyle.Interlaced = True stripStyle.SetShowAtWall(ChartWallType.Back, True) stripStyle.SetShowAtWall(ChartWallType.Left, True) linearScale.StripStyles.Add(stripStyle)
' apply style sheet Dim styleSheet As NStyleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Nevron) styleSheet.Apply(NChartControl1.Document)
Dim chart As NCartesianChart = CType(NChartControl1.Charts(0), NCartesianChart) chart.RangeSelections.Add(New NRangeSelection()) chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = True chart.Axis(StandardAxis.PrimaryY).ScrollBar.Visible = True
NChartControl1.Controller.Selection.Add(chart)
' configure interactivity NChartControl1.Controller.Tools.Add(New NAxisScrollTool()) NChartControl1.Controller.Tools.Add(New NDataZoomTool())
myCommand.Connection = conn myCommand.CommandText = SQL
myAdapter.SelectCommand = myCommand myAdapter.Fill(myData)
Dim dataBindingManager As NDataBindingManager = NChartControl1.DataBindingManager
dataBindingManager.EnableDataBinding = True
dataBindingManager.AddBinding(0, 0, "Values", myData, "l1_volts") dataBindingManager.UpdateChartControl()
NChartControl1.Refresh()
|