Profile Picture

Accessing Shininess Property Causes Chart Objects to Appear White

Posted By Lance Levendowski 8 Years Ago

Accessing Shininess Property Causes Chart Objects to Appear White

Author
Message
Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Lance,
The ambient / diffuse colors must match the color of the fill style. You'll also need to set the specular to white and emissive to black. Hope this helps - let us know if you meet any problems.


Best Regards,
Nevron Support Team



Lance Levendowski
Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 60, Visits: 157
Thank you for the feedback, but what should I set the Ambient, Diffuse, Specular and Emissive colors to in order to restore the appearance of the chart objects to what they were before the MaterialStyle.Shininess property was accessed?



Nevron Support
Posted 8 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Lance,
The problem in this case is that the MaterialStyle is created on demand with default values. For performance reasons all fill styles material style is initially null. You'll need to initialize the Ambient, Diffuse, Specular and Emissive colors from code if you don't want them to have the initial values (White for Ambient, Diffuse and Specular and Black for Emissive).

Best Regards,
Nevron Support Team



Lance Levendowski
Posted 8 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 60, Visits: 157
Getting or setting a series' FillStyle.MaterialStyle.Shininess property causes all of the bars to appear white, regardless of whether we change the property's value.

Is there any way to prevent this behavior?

See the following example:
Public Class ChartForm
  Inherits Windows.Forms.Form

  Public Sub New()
    Dim series1 As New Nevron.Chart.NBarSeries
    series1.BarShape = Nevron.Chart.BarShape.SmoothEdgeBar
    series1.HasBottomEdge = False

    series1.AddDataPoint(New Nevron.Chart.NDataPoint(3))
    series1.AddDataPoint(New Nevron.Chart.NDataPoint(1))
    series1.AddDataPoint(New Nevron.Chart.NDataPoint(2))
    series1.AddDataPoint(New Nevron.Chart.NDataPoint(5))
    series1.AddDataPoint(New Nevron.Chart.NDataPoint(4))

    'BUG: Getting or setting a series' FillStyle.MaterialStyle.Shininess property causes all of the bars to appear white, regardless of whether we change the property's value.
    ' NOTE: If you comment out the following line then the bars appear to have the appropriate color.
    Dim currentShininess As Single = series1.FillStyle.MaterialStyle.Shininess
    'series1.FillStyle.MaterialStyle.Shininess = series1.FillStyle.MaterialStyle.Shininess

    Dim chart As New Nevron.Chart.NCartesianChart
    chart.Enable3D = True
    chart.Series.Add(series1)

    Dim chartControl As New Nevron.Chart.WinForm.NChartControl
    chartControl.Charts.Clear()
    chartControl.Charts.Add(chart)
    chartControl.Dock = DockStyle.Fill

    chartControl.Controller.Tools.Clear()
    chartControl.Controller.Tools.Add(New Nevron.Chart.Windows.NTrackballTool())
    chartControl.Controller.Selection.Clear()
    chartControl.Controller.Selection.Add(chart)

    Me.Size = New Drawing.Size(800, 600)
    Me.StartPosition = FormStartPosition.CenterScreen
    Me.Controls.Add(chartControl)
  End Sub

End Class




Similar Topics


Reading This Topic