Skip to content

Issue adding a second series #15

Description

@RHaughton

Hi,

I'm having issues adding a second series to a chart. Here is my code:

List<PricePoint> ma20 = _equityTimeserie.Items
			.Where(item => item.MovingAverage.Days20 is not null)
			.Select(item => new PricePoint {
				Price = item.MovingAverage.Days20!.Value.AsDecimal(), 
				Time = item.Date.ToDateTime(), 
			})
			.ToList();

List<Ohlcv> ts = _equityTimeserie.Items
	.Select(item => new Ohlcv {
		Time = item.Date.ToDateTime(),
		Open = item.Price.Open.AsDecimal(),
		High = item.Price.High.AsDecimal(),
		Low = item.Price.Low.AsDecimal(),
		Close = item.Price.Close.AsDecimal()
	})
	.ToList();

var chartOptions = new ChartOptions {
	Width = -75,
	RightPriceScaleDecimalPrecision = 0,
};

var data = new ChartData { ChartEntries = [..ma20, ..ts], MarkerData = [] };

if (_tradingViewChart != null) {
	await _tradingViewChart.LoadChartAsync(data, chartOptions);
}

I've also tried:


// Same code as before

var data = new ChartData { ChartEntries = [ ..ts], MarkerData = [] };
var data2 = new ChartData { ChartEntries = [..ma20], MarkerData = [] };

if (_tradingViewChart != null) {
	await _tradingViewChart.LoadChartAsync(data, chartOptions);
	await _tradingViewChart.LoadChartAsync(data2, chartOptions);
}

Am I doing something wrong or the library doesn't support this case?

Thanks for your help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions