Profile Picture

Axis's PagingView.ViewRange issue

Posted By inhyuk son 14 Years Ago
Author
Message
bob milanov
Posted 14 Years Ago
View Quick Profile
Supreme Being

Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)Supreme Being (152 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 153, Visits: 11

Hi Inhyuk,

The problem with the code below is that the paging view will internally clip the range you specify to the currently valid axis range. At creation time the chart does not know the valid range (it is 0) as it has not calculated yet. You can force the control to recalculate / layout - the following code shows how to achieve this:

        private void Form1_Load(object sender, EventArgs e)
        {
            Random random = new Random();
            NChart chart = nChartControl1.Charts[0];

            NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);
            line.DataLabelStyle.Visible = false;
            line.Values.FillRandom(random, 100);

            // force control to recalculate
            nChartControl1.Document.Calculate();
            nChartControl1.Document.RecalcLayout(nChartControl1.View.Context);

            chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;
            chart.Axis(StandardAxis.PrimaryX).PagingView.Enabled = true;
            chart.Axis(StandardAxis.PrimaryX).PagingView.ViewRange = new NRange1DD(0, 50);//It doesn't work.

            nChartControl1.Controller.Tools.Add(new NSelectorTool());
            nChartControl1.Controller.Tools.Add(new NAxisScrollTool());

            nChartControl1.Refresh();
        }

Let me know if you meet any probelms...

Best regards,
Bob



inhyuk son
Posted 14 Years Ago
View Quick Profile
Junior Member

Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)Junior Member (21 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 21, Visits: 1
Hi~~
I set a axis's PagingView.ViewRange property for a scroll.
But a ViewRange properity does'nt change.

Sample code is here.
I'll wait your answer. Thanks~

private void Form1_Load(object sender, EventArgs e)
{
Random random = new Random();
NChart chart = nChartControl1.Charts[0];

NLineSeries line = (NLineSeries)chart.Series.Add(SeriesType.Line);
line.DataLabelStyle.Visible = false;
line.Values.FillRandom(random, 100);

chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;
chart.Axis(StandardAxis.PrimaryX).PagingView.Enabled = true;
chart.Axis(StandardAxis.PrimaryX).PagingView.ViewRange = new NRange1DD(0, 50);//It doesn't work.

//It does work. But I want to set only ViewRange.
//chart.Axis(StandardAxis.PrimaryX).PagingView = new NNumericAxisPagingView(new NRange1DD(0, 50));
//chart.Axis(StandardAxis.PrimaryX).PagingView.Enabled = true;

nChartControl1.Refresh();
}

private void button1_Click(object sender, EventArgs e)
{
//It does work.
nChartControl1.Charts[0].Axis(StandardAxis.PrimaryX).PagingView.ViewRange = new NRange1DD(0, 50);
nChartControl1.Refresh();
}



Similar Topics


Reading This Topic