Home Forums WinForms controls Xceed Chart for WinForms Real Time Line Series 2

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18860 |

    Hi!!!

    According to DataRows in DataTable I got that much no. of line series in my chart.
    now I want that for each row,each line series must be in diff color.
    I dont how many line series wll be created and drawn by user.Its tatally dynamic.
    According to data ,datarows wll be there in datatable and I want digg color for each line series that diaply the data in chart.
    I m very confuse that how can i manage it.

    Thanx in advance.
    I need y r help very soon if u can.
    Again Thanx.

    Khushboo

    Imported from legacy forums. Posted by khushboo (had 2140 views)

    Xceed Support
    Member
    Post count: 5658

    I am not sure to completely understand your inquiry. If you are trying to change the color of the line you are adding, you just need to modify the LineBorder.Color property.

    The following code adds a line (with a randomly chosen color) to a Chart with a button click.

    <code>
    public Form1()
    {
    InitializeComponent();
    random = new Random();
    }

    private Xceed.Chart.Core.Chart m_Chart;
    private Random random;

    private void Form1_Load( object sender, EventArgs e )
    {
    m_ChartControl.Settings.RenderDevice = RenderDevice.GDI;
    m_ChartControl.Background.FillEffect.SetGradient( GradientStyle.Horizontal, GradientVariant.Variant2, Color.Ivory, Color.Khaki );

    // add a header label
    ChartLabel header = m_ChartControl.Labels.AddHeader( “Different Color Lines” );
    header.TextProps.Backplane.Visible = false;
    header.TextProps.FillEffect.Color = Color.Navy;
    header.TextProps.Shadow.Type = ShadowType.Solid;
    header.TextProps.HorzAlign = HorzAlign.Left;
    header.TextProps.VertAlign = VertAlign.Top;
    header.HorizontalMargin = 2;
    header.VerticalMargin = 2;

    m_Chart = m_ChartControl.Charts[ 0 ];
    m_Chart.Axis( StandardAxis.Depth ).Visible = false;
    }

    private void butAddLine_Click( object sender, EventArgs e )
    {
    LineSeries m_Line = ( LineSeries )m_Chart.Series.Add( SeriesType.Line );
    m_Line.Name = “Line Serie ” + m_Chart.Series.Count.ToString();
    m_Line.DataLabels.Mode = DataLabelsMode.None;
    m_Line.Markers.Style = PointStyle.Cylinder;
    m_Line.Values.FillRandom( 5 );
    m_Line.LineBorder.Color = Color.FromArgb( random.Next( 255 ), random.Next( 255 ), random.Next( 255 ) );
    m_Line.LineBorder.Width = 3;

    m_ChartControl.Refresh();
    }

    private void butClear_Click( object sender, EventArgs e )
    {
    m_Chart.Series.Clear();
    m_ChartControl.Refresh();
    }
    </code>

    Imported from legacy forums. Posted by CharlesB (had 3126 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.