hi, I need to do this, you may do so with the spline control chart?and wore generic lists?, in the months I have X and Y value ranges with intervals of 5. be placed as the series? and agree to a month and a value I place a specified percentile point as the example. This is possible using the chart control?
i think so. how does this look?
protected void Page_Load(object sender, EventArgs e) { List<Widget> data = new List<Widget>(); for (int i = 0; i < 24; i++) { data.Add(new Widget() { Month = i.ToString(), Third = i * i + 3, Fifteenth = i * i + 15, Median = i * i + 50, EightyFifth = i * i + 85, NinetySeventh = i * i + 97 }); } this.UltraChart1.ChartType = ChartType.SplineChart; this.UltraChart1.SplineChart.MidPointAnchors = false; this.UltraChart1.Data.SwapRowsAndColumns = true; this.UltraChart1.Data.DataSource = data; this.UltraChart1.Data.DataBind(); } public class Widget { public string Month { get; set; } public double Third { get; set; } public double Fifteenth { get; set; } public double Median { get; set; } public double EightyFifth { get; set; } public double NinetySeventh { get; set; } }
hi, i finally try this wiht DataSet, but the lines don't paint correctly, the lines are with little curves. the first picture is my code try, the second picture is my goal. what should i do?
Dim ds = Me.GetDataIMC
UltraChart1.DataSource = dsUltraChart1.DataBind()UltraChart1.ChartType = ChartType.CompositeUltraChart1.Width = 1024UltraChart1.Height = 600'UltraChart1.TitleTop.Text = "titulo"UltraChart1.EnableCrossHair = True
Dim myChartArea As ChartArea = New ChartArea()UltraChart1.CompositeChart.ChartAreas.Add(myChartArea)
Dim myX As AxisItem = New AxisItem()myX.OrientationType = AxisNumber.X_AxismyX.DataType = AxisDataType.StringmyX.Labels.ItemFormatString = "<ITEM_LABEL>"myX.SetLabelAxisType = SetLabelAxisType.ContinuousDatamyX.MajorGridLines.Visible = True
Dim myY As AxisItem = New AxisItem()
Dim myYSecondary As AxisItem = New AxisItem()
Me.axisIMC(myY, myYSecondary)
myChartArea.Axes.Add(myX)myChartArea.Axes.Add(myY)myChartArea.Axes.Add(myYSecondary)
Dim mylayer As ChartLayerAppearance = New ChartLayerAppearance()mylayer.ChartType = ChartType.SplineChartmylayer.ChartArea = myChartAreamylayer.AxisX = myXmylayer.AxisY = myYmylayer.AxisY2 = myYSecondaryMe.layerIMC(ds, mylayer)
Dim SPlinechartappearance As New UltraChart.Resources.Appearance.SplineChartAppearanceDim line As New UltraChart.Resources.Appearance.LineAppearanceline.Thickness = 3line.LineStyle.DrawStyle = UltraChart.Shared.Styles.LineDrawStyle.Solidline.IconAppearance.Icon = UltraChart.Shared.Styles.SymbolIcon.Noneline.SplineTension = 0.5
SPlinechartappearance.LineAppearances.Add(line)
mylayer.ChartTypeAppearance = SPlinechartappearance
Me.UltraChart1.CompositeChart.ChartLayers.Add(mylayer)
Private Sub axisIMC(ByRef myY As AxisItem, ByRef myYSecondary As AxisItem) myY.OrientationType = AxisNumber.Y_Axis myY.DataType = AxisDataType.Numeric myY.Labels.ItemFormatString = "<DATA_VALUE:0>" myY.Labels.Orientation = TextOrientation.Horizontal myY.RangeType = AxisRangeType.Custom myY.RangeMin = 9 myY.RangeMax = 22 myY.TickmarkStyle = AxisTickStyle.DataInterval myY.TickmarkInterval = 1 myY.MajorGridLines.Visible = True
'add axis Y2 myYSecondary.OrientationType = AxisNumber.Y2_Axis 'myYSecondary = myY.Clone myYSecondary.DataType = AxisDataType.Numeric myYSecondary.Labels.ItemFormatString = "<DATA_VALUE:0>" myYSecondary.Labels.Orientation = TextOrientation.Horizontal myYSecondary.RangeType = AxisRangeType.Custom myYSecondary.RangeMin = 9 myYSecondary.RangeMax = 22 myYSecondary.TickmarkStyle = AxisTickStyle.DataInterval myYSecondary.TickmarkInterval = 1 myYSecondary.MajorGridLines.Visible = TrueEnd Sub
Private Sub layerIMC(ByVal ds As DataSet, ByRef itemLayer As ChartLayerAppearance) For i As Integer = 1 To ds.Tables(0).Columns.Count - 1
If ds.Tables(0).Columns(i).ColumnName = "P3" Or _ ds.Tables(0).Columns(i).ColumnName = "P15" Or _ ds.Tables(0).Columns(i).ColumnName = "P50" Or _ ds.Tables(0).Columns(i).ColumnName = "P85" Or _ ds.Tables(0).Columns(i).ColumnName = "P97" Then 'add series to Series collection. Dim myseries As NumericSeries = New NumericSeries() myseries.Label = ds.Tables(0).Columns(i).ToString() 'data bound myseries.Data.DataSource = ds.Tables(0) myseries.Data.LabelColumn = ds.Tables(0).Columns(0).ToString()
myseries.Data.ValueColumn = ds.Tables(0).Columns(i).ToString() UltraChart1.CompositeChart.Series.Add(myseries)
itemLayer.Series.Add(myseries)
End If
NextEnd Sub
Private Function GetDataIMC() As DataSet Dim mydata As New DataTable() mydata.Columns.Add("Mes", GetType(Integer)) mydata.Columns.Add("P1", GetType(Double)) mydata.Columns.Add("P3", GetType(Double)) mydata.Columns.Add("P5", GetType(Double)) mydata.Columns.Add("P15", GetType(Double)) mydata.Columns.Add("P25", GetType(Double)) mydata.Columns.Add("P50", GetType(Double)) mydata.Columns.Add("P75", GetType(Double)) mydata.Columns.Add("P85", GetType(Double)) mydata.Columns.Add("P95", GetType(Double)) mydata.Columns.Add("P97", GetType(Double)) mydata.Columns.Add("P99", GetType(Double)) mydata.Rows.Add(New [Object]() {0, 10.8, 11.2, 11.5, 12.1, 12.5, 13.3, 14.2, 14.7, 15.5, 15.9, 16.6}) mydata.Rows.Add(New [Object]() {1, 11.6, 12.1, 12.4, 13.2, 13.6, 14.6, 15.5, 16.1, 17.0, 17.3, 18.0}) mydata.Rows.Add(New [Object]() {2, 12.6, 13.2, 13.5, 14.3, 14.8, 15.8, 16.8, 17.4, 18.4, 18.8, 19.5}) mydata.Rows.Add(New [Object]() {3, 13.2, 13.7, 14.0, 14.9, 15.4, 16.4, 17.4, 18.0, 19.0, 19.4, 20.3}) mydata.Rows.Add(New [Object]() {4, 13.5, 14.0, 14.3, 15.2, 15.7, 16.7, 17.7, 18.3, 19.4, 19.8, 20.6}) mydata.Rows.Add(New [Object]() {5, 13.7, 14.2, 14.5, 15.3, 15.8, 16.8, 17.9, 18.5, 19.6, 20.0, 20.8})'... more information Dim ds As New DataSet ds.Tables.Add(mydata)
Return dsEnd Function
thanks
sample project attached
i ran this code and ended up with the attached image, so i'm not sure what the problem is. i'll attach my zipped sample project as well -- does it work for you?