Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Line Charts (Read 2713 times)
José Ricardo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jan 31st, 2021
Line Charts
Jan 31st, 2021 at 2:13am
Print Post  
hello, is it possible to create several Y axes for line charts?
I am using a chart to read an SQL database and show energy values but I need to have several Y axes (voltage, current, power ...) Thanks.
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Online


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Line Charts
Reply #1 - Jan 31st, 2021 at 9:34am
Print Post  
Hi,

It's possible using the components and layout API of base Dashboard class:

Code
Select All
var y2Axis = new YAxisRenderer(lineChart.YAxis, lineChart.XAxis);
y2Axis.GridColumn = 2;
y2Axis.PlotLeftSide = false;
y2Axis.GridRow = 0;
y2Axis.LabelsSource = lineChart.Plot;

lineChart.ChartPanel.Columns.Add(new GridColumn());
lineChart.ChartPanel.Children.Add(y2Axis); 



Check the MultipleAxes sample project for setting up axes to show different scales.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
José Ricardo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jan 31st, 2021
Re: Line Charts
Reply #2 - Jan 31st, 2021 at 5:48pm
Print Post  
hi,
Ok thanks for answer.
  
Back to top
 
IP Logged
 
José Ricardo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jan 31st, 2021
Re: Line Charts
Reply #3 - Jan 31st, 2021 at 6:08pm
Print Post  
Hi,

When I update the chart it draws the lines again without deleting the previous ones.
I use: lineChart1.Series.Clear(); to clear the series but need one function to clear the new YAxisRenderer and new LineRenderer to not always be adding on top of each other.

thanks.
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Online


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Line Charts
Reply #4 - Feb 1st, 2021 at 7:17am
Print Post  
Hi,

This repaints both the plot and legend correctly in my test -

Code
Select All
void button1_Click(object sender, EventArgs e)
{
    lineChart.Series.Clear();

    lineChart.Series.Add(
        new Series2D(
            new List<double> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 },
            new List<double> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 },
            labels
        ) { Title = "new series", SupportedLabels = LabelKinds.XAxisLabel });
} 



Let me know if you mean something different by updating the chart.

You shouldn't have to deal with LineRenderer yourself if using the LineChart class, but only if creating custom dashboards and mixing different kinds of graphics. LineChart has a default LineRenderer that draws whatever series you add to the chart's collection.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
José Ricardo
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 4
Joined: Jan 31st, 2021
Re: Line Charts
Reply #5 - Feb 2nd, 2021 at 12:46am
Print Post  
Hi, I used this code to clear the chart before updating with new values. Worked well.

lineChart1.Series.Clear();
lineChart1.Plot.SeriesRenderers.RemoveAt(position line renders);

thanks.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint