How to make a SfChart with a Json file?

Hi,

I'm trying to draw a RSI chart in SfChart. 

I know that SfChart supports some technical indicators out of the box (like RSI). Unfortunately, this is not useful for our purposes as you can only draw the chart but there's no way to get the actual calculated data behind it (the series of RSI values).

So I'm trying an alternative way with a JSON file.

Can you help me out with a basic, working example in WPF C# of how I would create a SfChart when I have the JSON file below as the input source (while using NewtonSoft.Json)?

Here you can get the JSON file I'm struggling with:
https://www.alphavantage.co/query?function=RSI&symbol=MSFT&interval=15min&time_period=10&series_type=close&apikey=demo

Attached is the Rsi.cs that defines the whole structure of the JSON file above.

Thanks in advance,
Sven

Attachment: Rsi_856f1d4.zip

1 Reply

MK Muneesh Kumar G Syncfusion Team March 28, 2018 06:47 AM UTC

Hi Sven, 
  
Thanks for using Syncfusion products.   
 
We have analyzed your query, we can achieve your requirement to generate chart using JSON file by using StreamReader as follows.  
 
Code snippet [C#]: 
 
 
public ViewModel() 
        { 
            using (var stream = GetType().Assembly.GetManifestResourceStream("SfChartDemo.Capacities.json")) 
            using (TextReader textStream = new StreamReader(stream)) 
            { 
                var text = textStream.ReadToEnd(); 
                Items = JsonConvert.DeserializeObject<List<Model>>(text); 
            } 
        } 
 
 
 
 
We have prepared a simple SfChart sample with JSON file input. Please find the sample from the following location.  
 
  
Thanks,  
Muneesh Kumar G.  
 


Loader.
Up arrow icon