Author |
Topic  |
|
Tomaso
16 Posts |
Posted - 25 Sep 2007 : 12:35:13
|
Why when change the attribute to a segment all the others comes reset to last segment setting attribute? Note that the change of the attribute is called from a command button named "btnSelezione"
An example is better of my English!
Imports com.quinncurtis.chart2dnet Imports System.Drawing Imports System.Drawing.Drawing2D
Public Class Test Inherits ChartView
Dim oPlot As SimpleLinePlot
Private Sub InitializeChart()
Dim cvGrafico As ChartView cvGrafico = Me
cvGrafico.BackColor = Color.Black cvGrafico.SetResizeMode(ChartObj.NO_RESIZE_OBJECTS)
Dim oDataSet As SimpleDataset Dim aValoriX() As Double = {10, 20, 30, 50, 80} Dim aValoriY() As Double = {10, 12, 20, 35, 45}
oDataSet = New SimpleDataset("A", aValoriX, aValoriY) Dim oTrasformazione As New CartesianCoordinates oTrasformazione = New CartesianCoordinates(0, 0, 100, 50) oTrasformazione.SetGraphBorderDiagonal(0.15, 0.15, 0.85, 0.85)
Dim oAttributiTraccia As ChartAttribute oAttributiTraccia = New ChartAttribute(Color.Violet, 1, DashStyle.Solid)
oPlot = New SimpleLinePlot(oTrasformazione, oDataSet, oAttributiTraccia) cvGrafico.AddChartObject(oPlot)
Dim oAttributoEvidenziato As ChartAttribute oAttributoEvidenziato = New ChartAttribute(Color.YellowGreen, 2, DashStyle.Solid) oPlot.SetSegmentAttributesMode(True) oPlot.SetSegmentAttributes(3, oAttributoEvidenziato) oPlot.SetSegmentAttributes(1, oAttributoEvidenziato)
oAttributoEvidenziato.SetColor(Color.Yellow) oPlot.SetSegmentAttributes(2, oAttributoEvidenziato)
End Sub
Private Sub gr_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load InitializeChart() End Sub
Private Sub btnSeleziona_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSeleziona.Click
Dim oAttributoEvidenziato As ChartAttribute oAttributoEvidenziato = New ChartAttribute(Color.Red, 2, DashStyle.Solid)
oPlot.SetSegmentAttributesMode(True) oPlot.SetSegmentAttributes(2, oAttributoEvidenziato)
Me.UpdateDraw()
End Sub End Class |
|
quinncurtis
1164 Posts |
Posted - 25 Sep 2007 : 13:20:33
|
Only call the oPlot.SetSegmentAttributesMode(True) method once, when you setup the line plot. If you call it a second time, it clears out the segment buffer. Your button routine should look like:
Private Sub btnSeleziona_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSeleziona.Click
Dim oAttributoEvidenziato As ChartAttribute
oAttributoEvidenziato = New ChartAttribute(Color.Red, 2, DashStyle.Solid)
oPlot.SetSegmentAttributes(2, oAttributoEvidenziato)
Me.UpdateDraw
End Sub()
|
 |
|
Tomaso
16 Posts |
Posted - 26 Sep 2007 : 02:31:30
|
Ok! I have tried to clear the buffer but I have not obtained the wished effect! I have used the follow instruction:
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancella.Click oTracciaA.SetSegmentAttributesMode(False) Me.UpdateDraw() End Sub
|
 |
|
quinncurtis
1164 Posts |
Posted - 26 Sep 2007 : 08:37:54
|
It is our assumption that you want to change a segment color, after you create the graph. That is what our example does. We tested it. If this is not correct, please explain in more detail what you are trying to do.
We did NOT tell you to clear the buffer.
We did NOT tell you to call SetSegmentAttributesMode again.
We did provide you with a button click method that set segment 2 to the new color.
Private Sub btnSeleziona_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSeleziona.Click
Dim oAttributoEvidenziato As ChartAttribute
oAttributoEvidenziato = New ChartAttribute(Color.Red, 2, DashStyle.Solid)
oPlot.SetSegmentAttributes(2, oAttributoEvidenziato)
Me.UpdateDraw
End Sub()
The rest of your program stays exactly the way it was originally. |
 |
|
|
Topic  |
|
|
|