Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
XamChart - Background Shows Through Graph
posted

I am creating a XamChart with multiple background colors to represent visually if the current value is within a desired range.  I create a ViewBox so that the control will resize itself and place a XamChart inside of the view box.  I am using 3 area series to draw the 3 colored background ranges and then a line series to draw my data.  The issue here is when the control resizes from being inside of the ViewBox, pixels for a given x-value are not repainted properly and I end up with vertical lines across the graph the same color as the Background property's brush.  The graph looks fine once it gets to be a certain size, but as it becomes smaller, the vertical lines become visible.  Setting the Background property is not a solution since that colors both the graph and a large rectangular area around the graph.

 

 

        <Viewbox Name="m_oButtPressureContainer" Grid.Row="1" Grid.Column="2"
                     VerticalAlignment="Bottom">
            <Infragistics:XamChart Name="m_oButtPressureChart">

                <Infragistics:XamChart.Legend>
                    <Infragistics:Legend Visible="False"/>
                </Infragistics:XamChart.Legend>

                <Infragistics:XamChart.Axes>
                    <Infragistics:Axis AxisType="PrimaryX" Minimum="0" Maximum="100" AutoRange="False" Unit="101" StrokeThickness="10"/>
                    <Infragistics:Axis AxisType="PrimaryY" Minimum="0" Maximum="255" AutoRange="False" Unit="256" StrokeThickness="10"/>
                </Infragistics:XamChart.Axes>

                <Infragistics:XamChart.Series>
                    <Infragistics:Series ChartType="Area" Fill="Red" Name="m_oButtPressureUpperOutOfRangeSeries" StrokeThickness="0"/>
                    <Infragistics:Series ChartType="Area" Fill="Green" Name="m_oButtPressureInRangeSeries" StrokeThickness="0"/>
                    <Infragistics:Series ChartType="Area" Fill="Red" Name="m_oButtPressureLowerOutOfRangeSeries" StrokeThickness="0"/>
                    <Infragistics:Series ChartType="Line" Fill="Black" Name="m_oButtPressureDataSeries"/>
                </Infragistics:XamChart.Series>

            </Infragistics:XamChart>
        </Viewbox>

Parents
  • 30692
    Offline posted

    Given this:

     

    <Viewbox Name="m_oButtPressureContainer" Grid.Row="1" Grid.Column="2" 
                         VerticalAlignment="Bottom">
            <Infragistics:XamChart Name="m_oButtPressureChart">
    
                <Infragistics:XamChart.Legend>
                    <Infragistics:Legend Visible="False"/>
                </Infragistics:XamChart.Legend>
    
                <Infragistics:XamChart.Axes>
                    <Infragistics:Axis AxisType="PrimaryX" Minimum="1" Maximum="10" AutoRange="False" Unit="101" StrokeThickness="10"/>
                    <Infragistics:Axis AxisType="PrimaryY" Minimum="0" Maximum="20" AutoRange="False" Unit="256" StrokeThickness="10"/>
                </Infragistics:XamChart.Axes>
    
                <Infragistics:XamChart.Series>
                    <Infragistics:Series ChartType="Area" Fill="Red" Name="m_oButtPressureUpperOutOfRangeSeries" StrokeThickness="0">
                        <Infragistics:Series.DataPoints>
                            <Infragistics:DataPoint Label="0" Value="20" />
                            <Infragistics:DataPoint Label="1" Value="20" />
                            <Infragistics:DataPoint Label="2" Value="20" />
                            <Infragistics:DataPoint Label="3" Value="20" />
                            <Infragistics:DataPoint Label="4" Value="20" />
                            <Infragistics:DataPoint Label="5" Value="20" />
                            <Infragistics:DataPoint Label="5" Value="20" />
                            <Infragistics:DataPoint Label="6" Value="20" />
                            <Infragistics:DataPoint Label="7" Value="20" />
                            <Infragistics:DataPoint Label="8" Value="20" />
                        </Infragistics:Series.DataPoints>
                    </Infragistics:Series>
                    <Infragistics:Series ChartType="Area" Fill="Green" Name="m_oButtPressureInRangeSeries" StrokeThickness="0">
                        <Infragistics:Series.DataPoints>
                            <Infragistics:DataPoint Label="0" Value="10" />
                            <Infragistics:DataPoint Label="1" Value="10" />
                            <Infragistics:DataPoint Label="2" Value="10" />
                            <Infragistics:DataPoint Label="3" Value="10" />
                            <Infragistics:DataPoint Label="4" Value="10" />
                            <Infragistics:DataPoint Label="5" Value="10" />
                            <Infragistics:DataPoint Label="6" Value="10" />
                            <Infragistics:DataPoint Label="7" Value="10" />
                            <Infragistics:DataPoint Label="8" Value="10" />
                            <Infragistics:DataPoint Label="9" Value="10" />
                        </Infragistics:Series.DataPoints>
                    </Infragistics:Series>
                    <Infragistics:Series ChartType="Area" Fill="Red" Name="m_oButtPressureLowerOutOfRangeSeries" StrokeThickness="0">
                        <Infragistics:Series.DataPoints>
                            <Infragistics:DataPoint Label="0" Value="5" />
                            <Infragistics:DataPoint Label="1" Value="5" />
                            <Infragistics:DataPoint Label="2" Value="5" />
                            <Infragistics:DataPoint Label="3" Value="5" />
                            <Infragistics:DataPoint Label="4" Value="5" />
                            <Infragistics:DataPoint Label="5" Value="5" />
                            <Infragistics:DataPoint Label="6" Value="5" />
                            <Infragistics:DataPoint Label="7" Value="5" />
                            <Infragistics:DataPoint Label="8" Value="5" />
                            <Infragistics:DataPoint Label="9" Value="5" />
                        </Infragistics:Series.DataPoints>
                    </Infragistics:Series>
                    <Infragistics:Series ChartType="Line" Fill="Black" Name="m_oButtPressureDataSeries">
                        <Infragistics:Series.DataPoints>
                            <Infragistics:DataPoint Label="0" Value="1" />
                            <Infragistics:DataPoint Label="1" Value="15" />
                            <Infragistics:DataPoint Label="2" Value="18" />
                            <Infragistics:DataPoint Label="3" Value="8" />
                            <Infragistics:DataPoint Label="4" Value="5" />
                            <Infragistics:DataPoint Label="5" Value="4" />
                            <Infragistics:DataPoint Label="6" Value="8" />
                            <Infragistics:DataPoint Label="7" Value="12" />
                            <Infragistics:DataPoint Label="8" Value="13" />
                            <Infragistics:DataPoint Label="9" Value="15" />
                        </Infragistics:Series.DataPoints>
                    </Infragistics:Series>
                </Infragistics:XamChart.Series>
    
            </Infragistics:XamChart>
        </Viewbox>
    

     Can you explain what I need to do to see the undesired behavior? What is your purpose of using the viewbox? Do you need the text/graphic size to increase along with the size of the chart? The chart can resize on its own to accomodate the change in size of its container.

    -Graham

Reply Children