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
210
Xamchart legend and label issue
posted

Hi

I am using Infragistics 11.2 xamchart control.The propblem  I am facing is

In my model i have something like this

public

double

XValue

{

get

{

return

m_xValue;

}

set

{

m_xValue =

value

;

OnPropertyChanged(

"XValue"

);

}

}

public double

YValue

{

get

{

return

m_yValue;

}

set

{

m_yValue =

value

;

OnPropertyChanged(

"YValue"

);

}

}

public string

Label

{

get

{

return

m_label;

}

set

{

m_label =

value

;

OnPropertyChanged(

"Label"

);

}

}

In my view model i have

public

ObservableCollection<Model

> _MyProperty;

public IEnumerable<Model

> MyPropertyA

{

get { return _MyProperty.Where<Model>(s => s.Label == "A"

); }

}

public IEnumerable<Model

> MyPropertyB

{

get { return _MyProperty.Where<Model>(s => s.Label == "B"

); }

}

 

 

 

public

ViewModel()

{

_MyProperty=

new ObservableCollection<Model

>


 


 


 

new Model{YValue=1000,XValue=.1,Label = "A"

},

new Model{YValue=1000,XValue=.1,Label = "B"

},

new Model{YValue=2000,XValue=.2,Label = "A"

},

new Model{YValue=4000,XValue=.2,Label = "B"

},

new Model{YValue=3000,XValue=.3,Label = "A"

},

new Model{YValue=6000,XValue=.3,Label = "B"

},

new Model{YValue=4000,XValue=.4,Label = "A"

},

new Model{YValue=9000,XValue=.4,Label = "B"

},

};

}

}

Now in xaml i am binding the series  like this

<igCA:XamChart.Series

>

<igCA:Series ChartType="ScatterLine" DataSource="{Binding MyPropertyA}" DataMapping="ValueX=XValue; ValueY=YValue" Label="{Binding Label

}" >

<igCA:Series.Marker

>

<igCA:Marker Foreground="{Binding Fill}"></igCA:Marker

>

</igCA:Series.Marker

>

</igCA:Series

>

<igCA:Series ChartType="ScatterLine" DataSource="{Binding MyPropertyB}" DataMapping="ValueX=XValue;ValueY=YValue" Label="{Binding Label

}">

<igCA:Series.Marker

>

<igCA:Marker Foreground="{Binding Fill}" ></igCA:Marker

>

</igCA:Series.Marker

>

</igCA:Series

>

</igCA:XamChart.Series

>

The chart gets plotted fine but the problem is that in the legend instead of A and B item 0 and item 1 is coming .Please help what can i do about it.

Also if i have suppose 4 series and each gets generated only when user gives some input for them through a grid or something, is it possible to show the legend for only the series that have been generated.

Thanks in advance


 

Parents Reply Children