Re: set different colors for periods on same task line - gantt

ASP.NET

ASP.NET AJAX & iPhone Controls

set different colors for periods on same task line - gantt

  • rated by 0 users
  • This post has 1 Reply |
  • 1 Follower
  • Hello,
    what we are trying to do, is set several time ranges for a task in a gantt chart. Problem we're currently facing, is that all the time ranges from one task line are printed in the same color, but we would like to set the color of each range. We are using the code from the gantt example from your website.

    Dim cdsc As ChartDataSeriesCollection = cg.ChartData.SeriesList
    cdsc.Clear()

    ' Testtask
    AddGanttSeriesData(cdsc, "Mercator", New DateTime() {New DateTime(2004, 2, 13), New DateTime(2004, 3, 8)}, New DateTime() {New DateTime(2004, 3, 5), New DateTime(2004, 3, 31)})End Sub


    Private Sub AddGanttSeriesData(ByVal cdsc As ChartDataSeriesCollection, ByVal taskName As String, ByVal startTimes() As DateTime, ByVal endTimes() As DateTime)Dim cds As ChartDataSeries = cdsc.AddNewSeries()
    cds.Label = taskName

    cds.Y.CopyDataIn(startTimes)

    cds.Y1.CopyDataIn(endTimes)

    End Sub 'AddGanttSeriesData


    So, what we would like to do, is set a color for the first range of time, and then a different color for the second range of time.
    I don't expect a perfect solution, but any clues or pointers towards one would be greatly appreciated.

  • You can change color of a certain data bar by using PointStyle.

     

    Such as following code will change color of second data bar of first data series –

    -----------------

    //Create a new point style

            C1.Win.C1Chart.PointStyle ps = new C1.Win.C1Chart.PointStyle();

           

            //Set Series index

             ps.SeriesIndex = 0;

     

            //Set Data point index

            ps.PointIndex = 1;

          

     

            //Set color for point style

            ps.SymbolStyle.Color = System.Drawing.Color.Green ;

     

            //Add this style to chart

            this.C1WebChart1.ChartGroups[0].ChartData.PointStylesList.Add(ps);

    ------------

     

    -Dave.

    <Kennethdm> wrote in message news:215697@10.0.1.98...

    Hello,
    what we are trying to do, is set several time ranges for a task in a gantt chart. Problem we're currently facing, is that all the time ranges from one task line are printed in the same color, but we would like to set the color of each range. We are using the code from the gantt example from your website.

    Dim cdsc As ChartDataSeriesCollection = cg.ChartData.SeriesList
    cdsc.Clear()

    ' Testtask
    AddGanttSeriesData(cdsc, "Mercator", New DateTime() {New DateTime(2004, 2, 13), New DateTime(2004, 3, 8)}, New DateTime() {New DateTime(2004, 3, 5), New DateTime(2004, 3, 31)})End Sub


    Private Sub AddGanttSeriesData(ByVal cdsc As ChartDataSeriesCollection, ByVal taskName As String, ByVal startTimes() As DateTime, ByVal endTimes() As DateTime)Dim cds As ChartDataSeries = cdsc.AddNewSeries()
    cds.Label = taskName

    cds.Y.CopyDataIn(startTimes)

    cds.Y1.CopyDataIn(endTimes)

    End Sub 'AddGanttSeriesData


    So, what we would like to do, is set a color for the first range of time, and then a different color for the second range of time.
    I don't expect a perfect solution, but any clues or pointers towards one would be greatly appreciated.



    http://helpcentral.componentone.com/cs/forums/p/78620/215697.aspx#215697

Page 1 of 1 (2 items)