Hi,
i have tried following thing for Stick chart. Following thing is worling fine now issue:
public partial class MainPage : UserControl |
{ |
public MainPage() |
{ |
InitializeComponent(); |
InitializeChart(); |
} |
private void InitializeChart() |
{ |
Telerik.Windows.Controls.Charting.StickSeriesDefinition cssd = new StickSeriesDefinition(); |
cssd.ShowItemToolTips = true; |
telerikChart.DefaultSeriesDefinition = cssd; |
telerikChart.ItemsSource = GetStocks(); |
SeriesMapping sm=new SeriesMapping(); |
sm.ItemMappings.Add(new ItemMapping("Name", DataPointMember.XCategory)); |
sm.ItemMappings.Add(new ItemMapping("Open",DataPointMember.Open)); |
sm.ItemMappings.Add(new ItemMapping("Close", DataPointMember.Close)); |
sm.ItemMappings.Add(new ItemMapping("Low", DataPointMember.Low)); |
sm.ItemMappings.Add(new ItemMapping("High", DataPointMember.High)); |
sm.ItemMappings.Add(new ItemMapping("High", DataPointMember.Tooltip)); |
telerikChart.SeriesMappings.Add(sm); |
telerikChart.DefaultSeriesDefinition.ShowItemLabels = true; |
} |
private List<Stock> GetStocks() |
{ |
List<Stock> lstStock = new List<Stock>(); |
for (int i = 0; i < 1000; i=i+100) |
{ |
Stock s = new Stock(); |
s.Name = "Stock" + i; |
s.Open = i + 100; |
s.Low = i; |
Random r = new Random(i); |
r.NextDouble(); |
s.Close = r.Next(100,150) + i; |
s.High = s.Close + i; |
lstStock.Add(s); |
} |
return lstStock; |
} |
} |
public class Stock |
{ |
public string Name { get; set; } |
public double Open { get; set; } |
public double Close { get; set; } |
public double High { get; set; } |
public double Low { get; set; } |
} |
Stick chart is also shown (Plz See attachment).
Issue:
I have set telerikChart.DefaultSeriesDefinition.ShowItemLabels = true;
so that to see the Item Label, but stick chart is showing 0 as highlighted in the screenshot. Is there way to see open,Close,Low.high value of the stick as a item label?
Can you please provide me good sample for the same. also provide pointer to doc that explains the Stick chart.