Profile Picture

Cannot correctly display NKagiSeries & NLineSeries on the same chart

Posted By Konstantin Safianov 11 Years Ago

Cannot correctly display NKagiSeries & NLineSeries on the same chart

Author
Message
Konstantin Safianov
Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 2, Visits: 1
The general problem is in foloowing: I need to display different types of series on the same chart.

I modified NKagiUC.cs file in Nevron.Examples.Chart.Winform by adding one more NLineSeries to the chart:

please see the main code from Initialize() method:
public override void Initialize()
{
base.Initialize();

NChart chart = nChartControl1.Charts[0];

// setup X axis
NPriceScaleConfigurator priceConfigurator = new NPriceScaleConfigurator();
priceConfigurator.InnerMajorTickStyle.LineStyle.Width = new NLength(0);
priceConfigurator.InnerMajorTickStyle.LineStyle.Color = Color.Green;
priceConfigurator.InnerMinorTickStyle.LineStyle.Width = new NLength(0);
chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = priceConfigurator;

// setup Y axis
NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator;
NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1);
stripStyle.Interlaced = true;
stripStyle.SetShowAtWall(ChartWallType.Back, true);
linearScale.StripStyles.Add(stripStyle);

// setup Kagi series
NKagiSeries kagi = (NKagiSeries)chart.Series.Add(SeriesType.Kagi);
kagi.UpStrokeStyle.Color = Color.MidnightBlue;
kagi.DownStrokeStyle.Color = Color.MidnightBlue;
kagi.UseXValues = true;

// add a line series
NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);
line.Name = "Line Series";
line.DataLabelStyle.Visible = false;
line.UseXValues = true;

GenerateData(kagi, line);
}

and GenerateData method does following:

private void GenerateData(NKagiSeries series, NLineSeries lineSeries)
{
NStockDataGenerator dataGenerator = new NStockDataGenerator(new NRange1DD(50, 350), 0.002, 2);
dataGenerator.Reset();

DateTime dt = new DateTime(2008, 2, 1);

for(int i = 0; i < 100; i++)
{
var nextValue = dataGenerator.GetNextValue();

series.Values.Add(nextValue);
lineSeries.Values.Add(nextValue);

series.XValues.Add(dt);
lineSeries.XValues.Add(dt);

dt = dt.AddDays(1);
}
}

On the XAxis I get showing of 1899 year that really is not referenced to any NKagiSeries or NLineSeries.
And I use "UseXValues = true" for both types of series.

And there in no any problem with separate displaying of the one series type (NKagiSeries or NLineSeries) on the chart.

It seems there is some bug or problem with "UseXValues = true" for NKagiSeries when it is used in couple with some other series type.

I am new in Nevron. And I will be appreciate for any feedback.
Thank you.

Konstantin.


Attachments
Problem.png (181 views, 177.00 KB)
Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Konstantin,

Kagi charts ignore the passage of time and the time axis of a Kagi is not linear. For this reason it is not possible to place a Kagi chart on the same X-axis with a Line or Stock chart. You can still place a Kagi and a Line series in the same chart, but you have to use different X axes (if this makes sense).



Best Regards,
Nevron Support Team



Konstantin Safianov
Posted 11 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)Forum Newbie (2 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 2, Visits: 1
Ok. And thank you very much for this feedback.
Best regards!



Similar Topics


Reading This Topic