Jump to content

 

llarsson

Member Since 25 Mar 2010
Offline Last Active May 10 2010 03:34 PM
-----

Topics I've Started

Nested properties as template

16 April 2010 - 08:44 AM

I couldn't get "." to work as in XAML with "Prop.NestedProp"
Is nested properties supported?
How do one do it?

My example is:

ChartMapping(dataSet, "MyX", "MyY"); // This works
ChartMapping(dataSet, "Complex.Item1", "Complex.Item2"); // This doesn't
...

      public void ChartMapping(IEnumerable data, string x, string y)
        {
            
            DataSeries ds = new DataSeries();

            ds.RenderAs = RenderAs.Line;

            ds.DataSource = data; // Observable collection

            DataMapping dm = new DataMapping();

            dm.MemberName = "XValue";

            dm.Path = x;

            ds.DataMappings.Add(dm);

            dm = new DataMapping();

            dm.MemberName = "YValue";

            dm.Path = y;

            ds.DataMappings.Add(dm);

            chartDetails.Series.Add(ds);

        }

...

    public class MyData : DependencyObject
    {
        public MyData (int x, int y)
        {
            MyX = x;
            MyY = y;
            Complex = new Tuple<int, int>(MyX, MyY);
        }

        public Tuple<int, int> Complex
        {
            get;
            set;
        }

        public int MyX
        {
            get;
            set;
        }

        public int MyY
        {
            get;
            set;
        }
    }

Static axis labels

06 April 2010 - 03:54 PM

Hi I would like to know if how one can create a static predefined axis labels that doesn't follow any regular interval and the series are of type line

ex. at X = 50,  Label="You are a donut"
       X = 128, Label="Cow is an animal"
       X = 150, Label="Banzai"
       X = 339, Label="Irregular distance"

on all other X values there shouldn't be any labels

Tabcontrol

29 March 2010 - 08:29 AM

Ah, sorry for the inconvienience but I rethought my question for this thread

When I add a dataSerie to a chart while it is located inside a tabitem -> tabcontroller -> grid it does not update
but if I add a dataserie to the same chart while directly located under the grid it updates

What can I do to make it work under a tabitem working on dataseries?

Should add that I work on silverligth 4.0 adding the chart throu XAML and later adding the serie throu code

This is most likely a beginners error since I am new to silverlight and C#

related post: previous thread (new thread as I think this is my fault and a more precise scenario)

Render - update

25 March 2010 - 08:37 AM

hi I am using version 3.0.5 and I am having trouble with re-rendering the chart when I update something. The chart is added with XAML and then updated with data collected from a WCF and since I haven't found any way to force manual re-render and it doesn't do it automatically most of the times (it re-renders sometimes but very seldom).

I think I also found a bug when it comes to series datapoints:

Following the basic generation of a chart as in the samples the following works:
DataPointCollection points = GetPoints();
foreach (DataPoint p in points)
{
serie.DataPoints.Add(p);
}

but this does not work:

DataPointCollection points = GetPoints();
serie.DataPoints = points;

Solution is to make it read-only or make any listeners update to the new collection instead of the old.