locked
Windows phone application RRS feed

  • Question

  • Hello i create a chart in my windows phone application with amchart

    I want to show the selection value in the chart in a messagebox how can i do this

    Thanks

    Thursday, May 29, 2014 11:31 AM

All replies

  • hi,

    try to use below code:

     <chart:SparrowChart x:Name="Chart1" Height="409" Margin="0,0,22,0">
                <chart:SparrowChart.Legend>
                    <chart:Legend Header="EUR/GBP" Height="55" Margin="155,0,172,4" Width="107" />
                </chart:SparrowChart.Legend>
                <chart:SparrowChart.DataContext>
                    <viewModels:ChartViewModel/>
                </chart:SparrowChart.DataContext>
                <chart:SparrowChart.XAxis>
                    <chart:LinearXAxis/>
                </chart:SparrowChart.XAxis>
                <chart:SparrowChart.YAxis>
                    <chart:LinearYAxis/>
                </chart:SparrowChart.YAxis>
                <chart:LineSeries PointsSource="{Binding Collection}" XPath="X" YPath="Y" IsRefresh="True"/>
            </chart:SparrowChart>

     List<CurrencyOfDate> list = new List<CurrencyOfDate>();
                foreach (XElement c in xmlData.Elements(ns + "Cube").Elements(ns + "Cube"))
                    list.Add(new CurrencyOfDate()
                    {
                        Date = c.Attribute("time").Value,
                        CurrencyTypes = (from k in xmlData.Elements(ns + "Cube").Elements(ns + "Cube").Elements(ns + "Cube")
                                         select new CurrencyType()
                                         {
                                             Name = k.Attribute("currency").Value,
                                             Value = k.Attribute("rate").Value
                                         }).ToList()
                    });
                FeatList = list;
                if (FeatList != null)
                {
                    foreach (var date in FeatList)
                    {
                        var x = DateTime.Parse(date.Date);
                        PickedDate.Add(x);
                    }
                    for (int i = 0; i < FeatList.Count; i++)
                    {
                        CurList = FeatList[i].CurrencyTypes.ToList();
                    }
                }
                MakeChartData();
    }
    private void MakeChartData()
        {
            try
            {
                IsDataLoading = true;
                for (int i = 0; i < CurList.Count; i++)
                {
                    var selectedCurrencyRates =
                        (from c in CurList where c.Name == "GBP" select c).ToList();
                    foreach (var selRate in selectedCurrencyRates)
                    {
                        double parsedFromValue = Double.Parse(selRate.Value);
                            CalculatedRate.Add(parsedFromValue);
                    }
                }
                GenerateDatas();
            }
            catch (Exception e)
            {
                IsDataLoading = false;
            }
            Refresh();
        }
        private void GenerateDatas()
        {
            Refresh();
            try
            {
                IsDataLoading = true;
                this.Collection.Add(new Model(PickedDate[0], CalculatedRate[0]));
                this.Collection.Add(new Model(PickedDate[10], CalculatedRate[10]));
                this.Collection.Add(new Model(PickedDate[20], CalculatedRate[20]));
                this.Collection.Add(new Model(PickedDate[30], CalculatedRate[30]));
                IsDataLoading = false;
            }
            catch (Exception ex)
            {
                IsDataLoading = false;
            }
        }

    Friday, May 30, 2014 8:48 AM
  • do u have this with amchart no sparrow
    Tuesday, June 3, 2014 9:37 AM
  • Wednesday, June 4, 2014 9:08 AM