void CreateData()
        {
            XDocument document = DataLoader.LoadXmlFromResources("/Data/Movies.xml");

            if (document != null)
            {
                foreach (XElement element in document.Element("Movies").Elements())
                {
                    PointSeries2D series = new PointSeries2D();
                    series.DisplayName         = element.Element("Name").Value;
                    series.ArgumentScaleType   = ScaleType.Numerical;
                    series.ToolTipPointPattern = "{S}\nProduction budget: {A}\nWorldwide grosses: {V}";
                    series.LabelsVisibility    = true;
                    series.Label                        = new SeriesLabel();
                    series.Label.TextPattern            = "{S}";
                    series.Label.ConnectorVisible       = false;
                    series.Label.ResolveOverlappingMode = ResolveOverlappingMode.Default;
                    series.AnimationAutoStartMode       = AnimationAutoStartMode.SetStartState;
                    double argument = Convert.ToDouble(element.Element("ProductionBudget").Value, CultureInfo.InvariantCulture);
                    double value    = Convert.ToDouble(element.Element("WorlwideGrosses").Value, CultureInfo.InvariantCulture);
                    series.Points.Add(new SeriesPoint(argument, value));
                    chart.Diagram.Series.Add(series);
                }
            }
        }
Ejemplo n.º 2
0
        List <StockDataPoint> CreateDataSource()
        {
            XDocument             document = DataLoader.LoadXmlFromResources("/Data/Dell.xml");
            List <StockDataPoint> result   = new List <StockDataPoint>();

            if (document != null)
            {
                IEnumerable <XElement> elements   = document.Element("Dell").Elements();
                IEnumerator            enumerator = elements.GetEnumerator();
                enumerator.MoveNext();
                StockDataPoint previousPoint = ReadDataPointFrpmXML((XElement)(enumerator.Current));

                foreach (XElement element in elements)
                {
                    StockDataPoint point = ReadDataPointFrpmXML(element);
                    point.ToolTipData.OpenDynamic    = GetStockDynamic(previousPoint.Open, point.Open).ImageSource;
                    point.ToolTipData.CloseDynamic   = GetStockDynamic(previousPoint.Close, point.Close).ImageSource;
                    point.ToolTipData.HighDynamic    = GetStockDynamic(previousPoint.High, point.High).ImageSource;
                    point.ToolTipData.LowDynamic     = GetStockDynamic(previousPoint.Low, point.Low).ImageSource;
                    point.ToolTipData.OpenFontBrush  = GetStockDynamic(previousPoint.Open, point.Open).Brush;
                    point.ToolTipData.CloseFontBrush = GetStockDynamic(previousPoint.Close, point.Close).Brush;
                    point.ToolTipData.HighFontBrush  = GetStockDynamic(previousPoint.High, point.High).Brush;
                    point.ToolTipData.LowFontBrush   = GetStockDynamic(previousPoint.Low, point.Low).Brush;
                    result.Add(point);
                    previousPoint = point;
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
        List <GoldPrice> CreateDataSource()
        {
            XDocument        document   = DataLoader.LoadXmlFromResources("/Data/GoldPrices.xml");
            List <GoldPrice> goldPrices = new List <GoldPrice>();

            if (document != null)
            {
                foreach (XElement element in document.Element("GoldPrices").Elements())
                {
                    DateTime date  = Convert.ToDateTime(element.Element("Date").Value, CultureInfo.InvariantCulture);
                    double   price = Convert.ToDouble(element.Element("Price").Value, CultureInfo.InvariantCulture);
                    goldPrices.Add(new GoldPrice(date, price));
                }
            }
            return(goldPrices);
        }
        List <OilPrice> CreateDataSource()
        {
            XDocument       document  = DataLoader.LoadXmlFromResources("/Data/OilPrices.xml");
            List <OilPrice> oilPrices = new List <OilPrice>();

            if (document != null)
            {
                foreach (XElement element in document.Element("OilPrices").Elements())
                {
                    double year  = Convert.ToDouble(element.Element("Year").Value, CultureInfo.InvariantCulture);
                    double price = Convert.ToDouble(element.Element("Price").Value, CultureInfo.InvariantCulture);
                    oilPrices.Add(new OilPrice(year, price));
                }
            }
            return(oilPrices);
        }
Ejemplo n.º 5
0
        List <GDP> GetGDPs()
        {
            XDocument  document = DataLoader.LoadXmlFromResources("/Data/GDPofG8.xml");
            List <GDP> result   = new List <GDP>();

            if (document != null)
            {
                foreach (XElement element in document.Element("G8GDPs").Elements())
                {
                    string  country = element.Element("Country").Value;
                    int     year    = int.Parse(element.Element("Year").Value);
                    decimal product = Convert.ToDecimal(element.Element("Product").Value, CultureInfo.InvariantCulture);
                    result.Add(new GDP(country, year, product));
                }
            }
            return(result);
        }
Ejemplo n.º 6
0
        List <Country> CreateDataSource()
        {
            XDocument      document  = DataLoader.LoadXmlFromResources("/Data/Countries.xml");
            List <Country> countries = new List <Country>();

            if (document != null)
            {
                foreach (XElement element in document.Element("Countries").Elements())
                {
                    double area         = Convert.ToDouble(element.Element("Area").Value, CultureInfo.InvariantCulture);
                    string name         = element.Element("Name").Value;
                    string officialName = element.Element("OfficialName").Value;
                    countries.Add(new Country(name, officialName, area));
                }
            }
            return(countries);
        }
Ejemplo n.º 7
0
        List <GSP> CreateDataSource()
        {
            XDocument  document = DataLoader.LoadXmlFromResources("/Data/GSP.xml");
            List <GSP> result   = new List <GSP>();

            if (document != null)
            {
                foreach (XElement element in document.Element("GSPs").Elements())
                {
                    string region  = element.Element("Region").Value;
                    string year    = element.Element("Year").Value;
                    double product = Convert.ToDouble(element.Element("Product").Value, CultureInfo.InvariantCulture);
                    result.Add(new GSP(region, year, product));
                }
            }
            return(result);
        }
        List <IndustryBubblePoint> CreateDataSource()
        {
            XDocument document = DataLoader.LoadXmlFromResources("/Data/Morbidity.xml");
            List <IndustryBubblePoint> result = new List <IndustryBubblePoint>();

            if (document != null)
            {
                foreach (XElement element in document.Element("Morbidity").Elements())
                {
                    IndustryBubblePoint point = new IndustryBubblePoint();
                    point.Name          = element.Element("Name").Value;
                    point.NumberOfCases = Convert.ToInt32(element.Element("NumberOfCases").Value, CultureInfo.InvariantCulture);
                    point.Rate          = Convert.ToDouble(element.Element("Rate").Value, CultureInfo.InvariantCulture);
                    result.Add(point);
                }
            }
            return(result);
        }
Ejemplo n.º 9
0
        List <HPIStatistics> GetHPIs()
        {
            XDocument            document = DataLoader.LoadXmlFromResources("/Data/HPI.xml");
            List <HPIStatistics> result   = new List <HPIStatistics>();

            if (document != null)
            {
                foreach (XElement element in document.Element("G20HPIs").Elements())
                {
                    string  country    = element.Element("Country").Value;
                    double  population = int.Parse(element.Element("Population").Value) / 1000000.0;
                    double  hpi        = Convert.ToDouble(element.Element("HPI").Value, CultureInfo.InvariantCulture);
                    decimal product    = Convert.ToDecimal(element.Element("Product").Value, CultureInfo.InvariantCulture);
                    result.Add(new HPIStatistics(country, population, hpi, product, string.Format("{0:n2}", hpi)));
                }
            }
            return(result);
        }
        List <Movie> CreateDataSource()
        {
            XDocument    document = DataLoader.LoadXmlFromResources("/Data/Movies.xml");
            List <Movie> result   = new List <Movie>();

            if (document != null)
            {
                foreach (XElement element in document.Element("Movies").Elements())
                {
                    Movie movie = new Movie();
                    movie.Name             = element.Element("Name").Value;
                    movie.ProductionBudget = Convert.ToDouble(element.Element("ProductionBudget").Value, CultureInfo.InvariantCulture);
                    movie.WorlwideGrosses  = Convert.ToDouble(element.Element("WorlwideGrosses").Value, CultureInfo.InvariantCulture);
                    movie.ReleaseDate      = element.Element("ReleaseDate").Value;
                    result.Add(movie);
                }
            }
            return(result);
        }
Ejemplo n.º 11
0
        static List <DataPoint> CreateFinancialDataSource()
        {
            XDocument        document   = DataLoader.LoadXmlFromResources("/Data/Dell.xml");
            List <DataPoint> dataSource = new List <DataPoint>();

            if (document != null)
            {
                foreach (XElement element in document.Element("Dell").Elements())
                {
                    dataSource.Add(DataPoint.CreateFinancialDataPoint(
                                       element.Element("Argument").Value,
                                       Convert.ToDouble(element.Element("LowValue").Value, CultureInfo.InvariantCulture),
                                       Convert.ToDouble(element.Element("HighValue").Value, CultureInfo.InvariantCulture),
                                       Convert.ToDouble(element.Element("OpenValue").Value, CultureInfo.InvariantCulture),
                                       Convert.ToDouble(element.Element("CloseValue").Value, CultureInfo.InvariantCulture)));
                }
            }
            return(dataSource);
        }
Ejemplo n.º 12
0
        public static List <CountryStatisticInfo> Load()
        {
            List <CountryStatisticInfo> data = new List <CountryStatisticInfo>();

            try {
                XDocument Top10LagerstCountriesInfo_xml = DataLoader.LoadXmlFromResources(UriToXmlFile);
                foreach (XElement countryInfo in Top10LagerstCountriesInfo_xml.Root.Elements("CountryInfo"))
                {
                    string name     = countryInfo.Element("Name").Value;
                    double areaSqKm = uint.Parse(countryInfo.Element("AreaSqrKilometers").Value);
                    List <PopulationStatisticByYear> statistic           = LoadStatistic(countryInfo.Element("Statistic"));
                    CountryStatisticInfo             countryInfoInstance = new CountryStatisticInfo(name, areaSqKm / 1000000, statistic);
                    data.Add(countryInfoInstance);
                }
            }
            catch {
            }
            return(data);
        }
Ejemplo n.º 13
0
        List <FinancialPoint> CreateDataSource()
        {
            XDocument             document = DataLoader.LoadXmlFromResources("/Data/Dell.xml");
            List <FinancialPoint> result   = new List <FinancialPoint>();

            if (document != null)
            {
                foreach (XElement element in document.Element("Dell").Elements())
                {
                    FinancialPoint point = new FinancialPoint();
                    point.Argument   = element.Element("Argument").Value;
                    point.OpenValue  = Convert.ToDouble(element.Element("OpenValue").Value, CultureInfo.InvariantCulture);
                    point.CloseValue = Convert.ToDouble(element.Element("CloseValue").Value, CultureInfo.InvariantCulture);
                    point.LowValue   = Convert.ToDouble(element.Element("LowValue").Value, CultureInfo.InvariantCulture);
                    point.HighValue  = Convert.ToDouble(element.Element("HighValue").Value, CultureInfo.InvariantCulture);
                    result.Add(point);
                }
            }
            return(result);
        }
Ejemplo n.º 14
0
        public static List <AgePopulation> CreateDataSource()
        {
            XDocument            document = DataLoader.LoadXmlFromResources("/Data/PopulationAgeStructure.xml");
            List <AgePopulation> result   = new List <AgePopulation>();

            if (document != null)
            {
                foreach (XElement genderElement in document.Element("Genders").Elements())
                {
                    string gender = genderElement.Element("Name").Value;
                    foreach (XElement ageElement in genderElement.Element("Ages").Elements())
                    {
                        string age = ageElement.Element("Value").Value;
                        foreach (XElement countryElement in ageElement.Element("Countries").Elements())
                        {
                            string country    = countryElement.Element("Name").Value;
                            double population = Convert.ToDouble(countryElement.Element("Population").Value, CultureInfo.InvariantCulture);
                            result.Add(new AgePopulation(country, age, gender, population));
                        }
                    }
                }
            }
            return(result);
        }
 XDocument LoadFromFile(string xmlFile)
 {
     return(DataLoader.LoadXmlFromResources(xmlFile));
 }