C# FlipView中的用户控件

C# FlipView中的用户控件,c#,binding,user-controls,windows-store-apps,flipview,C#,Binding,User Controls,Windows Store Apps,Flipview,摘要: 在FlipView上更改页面时,我无法让FlipView中的UserControl刷新/更新自身。UserControl依靠其代码来为自己的显示执行基本计算 简介: 我已经在Windows8中创建了一个graphing用户控件,因为目前没有这样的控件(除了一些第三方)。控件的XAML创建轴并声明用于实际绘制图形线的路径,代码隐藏实例化一个类,该类为该路径生成打印点。该图形路径类的实例化由代码中加载的事件处理程序在轴正确渲染后进行,以获得打印区域的大小。构造函数的参数包括特定于打印点的各种

摘要: 在FlipView上更改页面时,我无法让FlipView中的UserControl刷新/更新自身。UserControl依靠其代码来为自己的显示执行基本计算

简介: 我已经在Windows8中创建了一个graphing用户控件,因为目前没有这样的控件(除了一些第三方)。控件的XAML创建轴并声明用于实际绘制图形线的路径,代码隐藏实例化一个类,该类为该路径生成打印点。该图形路径类的实例化由代码中加载的事件处理程序在轴正确渲染后进行,以获得打印区域的大小。构造函数的参数包括特定于打印点的各种数据以及对用于缩放的子控件元素的引用

下面是控件:

<Grid>
    <Border Background="LightGray"
            Margin="0,10">
        <Grid Name="MainGrid">
            <Grid.RowDefinitions>
                <RowDefinition Height="1*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="2*"/>
                <ColumnDefinition Width="40*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Border Grid.Row="1"
                        Grid.Column="0" 
                        Grid.RowSpan="11"
                        Name="yAxisBorder">
                <!--this canvas is written to in DrawGraph.cs -->
                <Canvas Name="yAxis">
                </Canvas>
            </Border>
            <Border Grid.Row="11"
                        Grid.Column="1"
                        Name="xAxisBorder" 
                        BorderBrush="Black">
                <!--this canvas is written to in DrawGraph.cs -->
                <Canvas Name="xAxis"/>
            </Border>
            <Border x:Name ="GraphAxis"
                        Grid.Row="1"
                        Grid.Column="1"
                        Grid.RowSpan="10"
                        BorderThickness="2,2,2,2" 
                        BorderBrush="Black"
                        Loaded="GraphAxis_Loaded">
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1"
                                                StartPoint="0.5,0">
                        <GradientStop Color="Black"/>
                        <GradientStop x:Name="GraphStop2" 
                                            Offset="0.554" Color="White"/>
                    </LinearGradientBrush>
                </Border.Background>
                <!--this path is written to in DrawGraph.cs -->
                <Path x:Name="GraphLine" 
                            StrokeThickness="2"
                            Data="M0,0">
                    <Path.Stroke>
                        <SolidColorBrush Color="Black"/>
                    </Path.Stroke>
                    <Path.Fill>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="Black"/>
                            <GradientStop Color="LightPink"
                                                Offset="1"/>
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
            </Border>
            <!--These borders draw the grid-lines on the graph-->
            <Border Grid.Row="1"
                        Grid.Column="1"
                        BorderThickness="0,0,0,0.5" 
                        BorderBrush="Black"/>
            <Border Grid.Row="2"
                        Grid.Column="1"
                        BorderThickness="0,0,0,0.5" 
                        BorderBrush="Black">
            </Border>
            <Border Grid.Row="3"
                        Grid.Column="1"
                        BorderThickness="0,0,0,0.5" 
                        BorderBrush="Black">
            </Border>
            <Border Grid.Row="4"
                        Grid.Column="1"
                        BorderThickness="0,0,0,0.5" 
                        BorderBrush="Black">
            </Border>
            <!--This border is for drawing the x-axis for -ve inflation-->
            <Border Grid.Row="5"
                        Grid.Column="1"
                        x:Name="xAxisLine1"
                        BorderThickness="0,0,0,0.5" 
                        BorderBrush="Black">
            </Border>
            <Border Grid.Row="6"
                        Grid.Column="1"
                        BorderThickness="0,0,0,0.5" 
                        BorderBrush="Black">
            </Border>
            <Border Grid.Row="7"
                        Grid.Column="1"
                        BorderThickness="0,0,0,0.5" 
                        BorderBrush="Black">
            </Border>
            <Border Grid.Row="8"
                        Grid.Column="1"
                        BorderThickness="0,0,0,0.5" 
                        BorderBrush="Black">
            </Border>
            <Border Grid.Row="9"
                        Grid.Column="1"
                        BorderThickness="0,0,0,0.5" 
                        BorderBrush="Black">
            </Border>
            <Border x:Name="xAxisLine2"
                        Grid.Row="10"
                        Grid.Column="1"
                        BorderThickness="0,0,0,2" 
                        BorderBrush="Black">
            </Border>
        </Grid>
    </Border>
</Grid>
…最后是DrawGraph类:

public class DrawGraph
{
    List<String> months = new List<string> { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };

    public DrawGraph(Country currentC, string nearMonth, int nearYear, string farMonth, int farYear, double cHeight, double cWidth, Path pGraphLine, Canvas xAxis, Border xAxisBorder, Canvas yAxis, Grid GraphGrid, Border xAxisLine1, Border xAxisLine2)
    {
        int periods = 0, years = farYear - nearYear, firstDateIndex = 0, lastDateIndex = 0, n = 0, prIndex = 0, yScalePve = 0, yScaleNve = 0, yScaleExtent = 0;
        double endDateIndex, minFactor = 1000, maxFactor = 0, inflationFactor,
               baseFactor = 0, yOffSet = 0;
        plotPoint[] plotResults;

        cHeight -= 4; // this is for the 4 pixels taken up by the border
        // count up the months between the start and end points
        foreach (KeyValuePair<string, double> rpiRecord in currentC.RpiData)
        {
            if (rpiRecord.Key == nearMonth + nearYear.ToString())
            {
                firstDateIndex = n;
            }
            if (rpiRecord.Key == farMonth + farYear.ToString())
            {
                lastDateIndex = n;
            }
            n++;
        }

        // calculate the number of points to plot
        periods = lastDateIndex - firstDateIndex + 1;

        // put together the array of dates (relative) and factors to plot
        if (periods > 1)
        {
            plotResults = new plotPoint[periods];

            n = 0;
            foreach (KeyValuePair<string, double> rpiRecord in currentC.RpiData)
            {
                if (n >= firstDateIndex & n <= lastDateIndex)
                {
                    if (n == firstDateIndex)
                    {
                        baseFactor = rpiRecord.Value;
                        plotResults[prIndex] = new plotPoint(prIndex, 0);
                        minFactor = 0;
                        maxFactor = 0;
                    }
                    else
                    {
                        // get the inflation factor and date position and populate the plotPoints array
                        inflationFactor = (rpiRecord.Value - baseFactor) / baseFactor * 100;
                        plotResults[prIndex] = new plotPoint(prIndex, inflationFactor);
                        // these are used for the height scaling
                        if (inflationFactor > maxFactor)
                        {
                            maxFactor = inflationFactor;
                        }
                        if (inflationFactor < minFactor & rpiRecord.Value != 0)
                        {
                            minFactor = inflationFactor;
                        }
                    }
                    prIndex++;
                }
                n++;
            }
            // now decide on the y-axis scale
            // firstly, is the maximum in the units, tens, hundreds or thousands

            if (maxFactor - 1 < 0)
            {
                yScalePve = 1;
            }
            else if (maxFactor - 2 < 0)
            {
                yScalePve = 2;
            }
            else if (maxFactor - 5 < 0)
            {
                yScalePve = 5;
            }
            else if (maxFactor - 10 < 0)
            {
                yScalePve = 10;
            }
            else if (maxFactor - 50 < 0)
            {
                yScalePve = 50;
            }
            else if (maxFactor - 100 < 0)
            {
                yScalePve = 100;
            }
            else if (maxFactor - 500 < 0)
            {
                yScalePve = 500;
            }
            else if (maxFactor - 1000 < 0)
            {
                yScalePve = 1000;
            }
            else if (maxFactor - 5000 < 0)
            {
                yScalePve = 5000;
            }
            else
            {
                yScalePve = 10000;
            }

            if (minFactor < 0)
            {
                if (minFactor + 1 > 0)
                {
                    yScaleNve = 1;
                }
                else if (minFactor + 2 > 0)
                {
                    yScaleNve = 2;
                }
                else if (minFactor + 5 > 0)
                {
                    yScaleNve = 5;
                }
                else if (minFactor + 10 > 0)
                {
                    yScaleNve = 10;
                }
                else if (minFactor + 50 > 0)
                {
                    yScaleNve = 50;
                }
                else if (minFactor + 100 > 0)
                {
                    yScaleNve = 100;
                }
                else if (minFactor + 500 > 0)
                {
                    yScaleNve = 500;
                }
                else if (minFactor + 1000 > 0)
                {
                    yScaleNve = 1000;
                }
                else if (minFactor + 5000 > 0)
                {
                    yScaleNve = 5000;
                }
                else
                {
                    yScaleNve = 10000;
                }
                // calculate the position of the xAxis on the yScale
                if (maxFactor <= minFactor * -100) // this is to prevent small -ves moving the x-axis to the middle
                {
                    yOffSet = cHeight / 2;
                }
            }

            // calculate the position of the xAxis on the yScale
            yScaleExtent = yScalePve + yScaleNve;

            if (cHeight > 0) // this prevents the borders being re-sized before the grids have been rendered
            {
                // this re-sizes the rows in the grid displaying the graph - there is a border in the 5th row (defined in the XAML)
                // which acts as the x axis and this adjusts the line thickness to where the x axis should be
                if (yOffSet == 0)
                {
                    // this draws the x-axis when it is at the bottom position                
                    xAxisLine1.BorderThickness = new Thickness(0, 0, 0, 1);
                    xAxisLine2.BorderThickness = new Thickness(0, 0, 0, 2);
                    cHeight += 1; // this is for the extra pixel taken up by the border
                }
                else
                {
                    // this draws the x-axis when it is at the middle position                
                    xAxisLine1.BorderThickness = new Thickness(0, 0, 0, 2);
                    xAxisLine2.BorderThickness = new Thickness(0, 0, 0, 1);
                    cHeight -= 1; // this is for the extra pixel taken up by the border
                }
            }

            // this is used for the width scaling
            endDateIndex = plotResults[plotResults.Length - 1].plotDate;

            // zero-base the plot results                
            plotResults[0].plotDate = 0;
            plotResults[0].plotFactor = 0 + yOffSet;

            PathFigure myPathFigure = new PathFigure();
            myPathFigure.StartPoint = new Point(0, cHeight - yOffSet);
            PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
            for (int x = 1; x < plotResults.Length; x++)
            {
                // re-base the array dates with respect to the plot area width
                plotResults[x].plotDate *= cWidth / endDateIndex;
                // re-base the array factors with respect to the y-axis
                plotResults[x].plotFactor = plotResults[x].plotFactor / yScaleExtent;
                // then re-base the array into the units of the plot area
                plotResults[x].plotFactor = plotResults[x].plotFactor * (cHeight - yOffSet);

                // generate the LineSegment objects for each plotPoint
                LineSegment myLineSegment = new LineSegment();
                myLineSegment.Point = new Point(plotResults[x].plotDate, (cHeight - yOffSet) - plotResults[x].plotFactor);
                myPathSegmentCollection.Add(myLineSegment);
            }

            // these 2 additional line segments create an enclosed polygon for the fill to go into  
            LineSegment myLineSegment1 = new LineSegment();
            // this line draws down vertically on the right-hand y axis
            myLineSegment1.Point = new Point(cWidth, cHeight - yOffSet); //
            myPathSegmentCollection.Add(myLineSegment1);
            LineSegment myLineSegment2 = new LineSegment();
            // this line draws across to the left on the x axis
            myLineSegment2.Point = new Point(0, cHeight - yOffSet);
            myPathSegmentCollection.Add(myLineSegment2);

            // this sets up the LineSegments for the PathFigure, the 
            // PathFigure for the PathGeometry and the PathGeometry for the PathData!!

            myPathFigure.Segments = myPathSegmentCollection;

            PathFigureCollection myPathFigureCollection = new PathFigureCollection();
            myPathFigureCollection.Add(myPathFigure);

            PathGeometry myPathGeometry = new PathGeometry();

            myPathGeometry.Figures = myPathFigureCollection;

            pGraphLine.Data = myPathGeometry;
            Calculate_xAxis(nearYear, farYear, nearMonth, farMonth, xAxis, xAxisBorder);
            Calculate_yAxis(yScalePve, yScaleNve, xAxis, yAxis, yOffSet);
        }
    }
公共类绘图
{
列表月份=新列表{“一月”、“二月”、“三月”、“四月”、“五月”、“六月”、“七月”、“八月”、“九月”、“十月”、“十一月”、“十二月”};
公共绘图(国家/地区当前C、字符串近月、整数近年、字符串农业月、整数远年、双支票、双cWidth、路径pGraphLine、画布xAxis、边框xAxisBorder、画布yAxis、栅格图栅格、边框xAxisLine1、边框xAxisLine2)
{
int periods=0,years=farYear-nearYear,firstDateIndex=0,lastDateIndex=0,n=0,prIndex=0,yScalePve=0,yScaleNve=0,yScaleExtent=0;
double-endDateIndex,minFactor=1000,maxFactor=0,inflationFactor,
基本因子=0,约夫特=0;
绘图点[]绘图结果;
cHeight-=4;//这是用于边界占用的4个像素
//计算起点和终点之间的月份
foreach(currentC.RpiData中的KeyValuePair rpireRecord)
{
if(rpiRecord.Key==nearMonth+nearYear.ToString())
{
firstDateIndex=n;
}
if(rpiRecord.Key==farMonth+farYear.ToString())
{
lastDateIndex=n;
}
n++;
}
//计算要打印的点数
句点=lastDateIndex-firstDateIndex+1;
//将要绘制的日期(相对)和因素数组放在一起
如果(周期>1)
{
plotResults=新的绘图点[期间];
n=0;
foreach(currentC.RpiData中的KeyValuePair rpireRecord)
{
if(n>=firstDateIndex&n maxFactor)
{
maxFactor=通货膨胀系数;
}
if(通货膨胀系数<最小系数&rpiRecord.Value!=0)
{
minFactor=通货膨胀系数;
}
}
prIndex++;
}
n++;
}
//现在决定y轴比例
//首先,最大值是以单位表示的,几十、几百还是几千
如果(最大因子-1<0)
{
yScalePve=1;
}
else if(最大因子-2<0)
{
yScalePve=2;
}
否则如果(最大因子-5<0)
{
yScalePve=5;
}
否则如果(最大因子-10<0)
{
yScalePve=10;
}
否则如果(最大系数-50<0)
{
yScalePve=50;
}
否则如果(最大因子-100<0)
{
yScalePve=100;
}
否则如果(最大系数-500<0)
{
yScalePve=500;
}
否则如果(最大因子-1000<0)
{
yScalePve=1000;
}
否则如果(最大系数-5000<0)
{
yScalePve=5000;
}
其他的
{
yScalePve=10000;
}
如果(最小系数<0)
{
如果(最小系数+1>0)
{
yScaleNve=1;
}
否则如果(最小因子+2>0)
{
yScaleNve=2;
}
否则如果(最小系数+5>0)
{
yScaleNve=5;
}
否则如果(最小系数+10>0)
{
yScaleNve=10;
}
否则如果(最小系数+50>0)
{
yScaleNve=50;
}
否则如果(最小系数+100>0)
{
yScaleNve=100;
}
否则如果(最小系数+500>0)
{
yScaleNve=500;
}
否则如果(最小因子+1000>0)
{
yScaleNve=1000;
}
否则如果(最小系数+5000>0)
{
yScaleNve=5000;
}
其他的
{
yScaleNve=10000;
}
//计算X轴在yScale上的位置
if(maxFactor 0)//这将防止在渲染网格之前重新调整边界大小
{
//这将重新调整显示图形的网格中的行的大小-第5行中有一个边框(在XAML中定义)
//它充当x轴,并将线厚度调整到x轴应位于的位置
如果(yOffSet==0)
{
//这将在x轴位于底部位置时绘制x轴
public class DrawGraph
{
    List<String> months = new List<string> { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };

    public DrawGraph(Country currentC, string nearMonth, int nearYear, string farMonth, int farYear, double cHeight, double cWidth, Path pGraphLine, Canvas xAxis, Border xAxisBorder, Canvas yAxis, Grid GraphGrid, Border xAxisLine1, Border xAxisLine2)
    {
        int periods = 0, years = farYear - nearYear, firstDateIndex = 0, lastDateIndex = 0, n = 0, prIndex = 0, yScalePve = 0, yScaleNve = 0, yScaleExtent = 0;
        double endDateIndex, minFactor = 1000, maxFactor = 0, inflationFactor,
               baseFactor = 0, yOffSet = 0;
        plotPoint[] plotResults;

        cHeight -= 4; // this is for the 4 pixels taken up by the border
        // count up the months between the start and end points
        foreach (KeyValuePair<string, double> rpiRecord in currentC.RpiData)
        {
            if (rpiRecord.Key == nearMonth + nearYear.ToString())
            {
                firstDateIndex = n;
            }
            if (rpiRecord.Key == farMonth + farYear.ToString())
            {
                lastDateIndex = n;
            }
            n++;
        }

        // calculate the number of points to plot
        periods = lastDateIndex - firstDateIndex + 1;

        // put together the array of dates (relative) and factors to plot
        if (periods > 1)
        {
            plotResults = new plotPoint[periods];

            n = 0;
            foreach (KeyValuePair<string, double> rpiRecord in currentC.RpiData)
            {
                if (n >= firstDateIndex & n <= lastDateIndex)
                {
                    if (n == firstDateIndex)
                    {
                        baseFactor = rpiRecord.Value;
                        plotResults[prIndex] = new plotPoint(prIndex, 0);
                        minFactor = 0;
                        maxFactor = 0;
                    }
                    else
                    {
                        // get the inflation factor and date position and populate the plotPoints array
                        inflationFactor = (rpiRecord.Value - baseFactor) / baseFactor * 100;
                        plotResults[prIndex] = new plotPoint(prIndex, inflationFactor);
                        // these are used for the height scaling
                        if (inflationFactor > maxFactor)
                        {
                            maxFactor = inflationFactor;
                        }
                        if (inflationFactor < minFactor & rpiRecord.Value != 0)
                        {
                            minFactor = inflationFactor;
                        }
                    }
                    prIndex++;
                }
                n++;
            }
            // now decide on the y-axis scale
            // firstly, is the maximum in the units, tens, hundreds or thousands

            if (maxFactor - 1 < 0)
            {
                yScalePve = 1;
            }
            else if (maxFactor - 2 < 0)
            {
                yScalePve = 2;
            }
            else if (maxFactor - 5 < 0)
            {
                yScalePve = 5;
            }
            else if (maxFactor - 10 < 0)
            {
                yScalePve = 10;
            }
            else if (maxFactor - 50 < 0)
            {
                yScalePve = 50;
            }
            else if (maxFactor - 100 < 0)
            {
                yScalePve = 100;
            }
            else if (maxFactor - 500 < 0)
            {
                yScalePve = 500;
            }
            else if (maxFactor - 1000 < 0)
            {
                yScalePve = 1000;
            }
            else if (maxFactor - 5000 < 0)
            {
                yScalePve = 5000;
            }
            else
            {
                yScalePve = 10000;
            }

            if (minFactor < 0)
            {
                if (minFactor + 1 > 0)
                {
                    yScaleNve = 1;
                }
                else if (minFactor + 2 > 0)
                {
                    yScaleNve = 2;
                }
                else if (minFactor + 5 > 0)
                {
                    yScaleNve = 5;
                }
                else if (minFactor + 10 > 0)
                {
                    yScaleNve = 10;
                }
                else if (minFactor + 50 > 0)
                {
                    yScaleNve = 50;
                }
                else if (minFactor + 100 > 0)
                {
                    yScaleNve = 100;
                }
                else if (minFactor + 500 > 0)
                {
                    yScaleNve = 500;
                }
                else if (minFactor + 1000 > 0)
                {
                    yScaleNve = 1000;
                }
                else if (minFactor + 5000 > 0)
                {
                    yScaleNve = 5000;
                }
                else
                {
                    yScaleNve = 10000;
                }
                // calculate the position of the xAxis on the yScale
                if (maxFactor <= minFactor * -100) // this is to prevent small -ves moving the x-axis to the middle
                {
                    yOffSet = cHeight / 2;
                }
            }

            // calculate the position of the xAxis on the yScale
            yScaleExtent = yScalePve + yScaleNve;

            if (cHeight > 0) // this prevents the borders being re-sized before the grids have been rendered
            {
                // this re-sizes the rows in the grid displaying the graph - there is a border in the 5th row (defined in the XAML)
                // which acts as the x axis and this adjusts the line thickness to where the x axis should be
                if (yOffSet == 0)
                {
                    // this draws the x-axis when it is at the bottom position                
                    xAxisLine1.BorderThickness = new Thickness(0, 0, 0, 1);
                    xAxisLine2.BorderThickness = new Thickness(0, 0, 0, 2);
                    cHeight += 1; // this is for the extra pixel taken up by the border
                }
                else
                {
                    // this draws the x-axis when it is at the middle position                
                    xAxisLine1.BorderThickness = new Thickness(0, 0, 0, 2);
                    xAxisLine2.BorderThickness = new Thickness(0, 0, 0, 1);
                    cHeight -= 1; // this is for the extra pixel taken up by the border
                }
            }

            // this is used for the width scaling
            endDateIndex = plotResults[plotResults.Length - 1].plotDate;

            // zero-base the plot results                
            plotResults[0].plotDate = 0;
            plotResults[0].plotFactor = 0 + yOffSet;

            PathFigure myPathFigure = new PathFigure();
            myPathFigure.StartPoint = new Point(0, cHeight - yOffSet);
            PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
            for (int x = 1; x < plotResults.Length; x++)
            {
                // re-base the array dates with respect to the plot area width
                plotResults[x].plotDate *= cWidth / endDateIndex;
                // re-base the array factors with respect to the y-axis
                plotResults[x].plotFactor = plotResults[x].plotFactor / yScaleExtent;
                // then re-base the array into the units of the plot area
                plotResults[x].plotFactor = plotResults[x].plotFactor * (cHeight - yOffSet);

                // generate the LineSegment objects for each plotPoint
                LineSegment myLineSegment = new LineSegment();
                myLineSegment.Point = new Point(plotResults[x].plotDate, (cHeight - yOffSet) - plotResults[x].plotFactor);
                myPathSegmentCollection.Add(myLineSegment);
            }

            // these 2 additional line segments create an enclosed polygon for the fill to go into  
            LineSegment myLineSegment1 = new LineSegment();
            // this line draws down vertically on the right-hand y axis
            myLineSegment1.Point = new Point(cWidth, cHeight - yOffSet); //
            myPathSegmentCollection.Add(myLineSegment1);
            LineSegment myLineSegment2 = new LineSegment();
            // this line draws across to the left on the x axis
            myLineSegment2.Point = new Point(0, cHeight - yOffSet);
            myPathSegmentCollection.Add(myLineSegment2);

            // this sets up the LineSegments for the PathFigure, the 
            // PathFigure for the PathGeometry and the PathGeometry for the PathData!!

            myPathFigure.Segments = myPathSegmentCollection;

            PathFigureCollection myPathFigureCollection = new PathFigureCollection();
            myPathFigureCollection.Add(myPathFigure);

            PathGeometry myPathGeometry = new PathGeometry();

            myPathGeometry.Figures = myPathFigureCollection;

            pGraphLine.Data = myPathGeometry;
            Calculate_xAxis(nearYear, farYear, nearMonth, farMonth, xAxis, xAxisBorder);
            Calculate_yAxis(yScalePve, yScaleNve, xAxis, yAxis, yOffSet);
        }
    }