Software FX Posted November 2, 2000 Report Share Posted November 2, 2000 The complete source of my last sample for some users which do not have VB6 is: '=========================================================== Option Explicit Sub example2_Click() Dim Today As Date Today = #10/1/2000# With ChartFX1 .Gallery = GANTT .Chart3D = False ' 3D won't look overlapped .Cluster = True ' All segments in the same line .MultipleColors = True .TipMask = "%l" & vbCrLf & "%i to %v" 'First set the Min and Max for the Y Axis With .Axis(AXIS_Y) .Min = Today .Max = Today + 120 .Format = AF_DATETIME .LabelAngle = 90 .STEP = 7 End With 'Then we can use the ValueEX and IniValueEX for the Gantt Chart. ' Let's suppose it has 3 bars .MultipleColors = False .OpenDataEx COD_VALUES, 10, 1 '4 variables for bar/2 machines .OpenDataEx COD_INIVALUES, 10, 1 '4 variables for bar/2 machines .OpenDataEx COD_COLORS, 10, 1 'The legends have a particular behavior 'For example, if the chart has 4 legends, one for 'every point for the machine1 (on, off, down, starved) 'the first 4 color in the machine1 bar will be 'taken to colorize the first 4 names in the legend 'my suggestion is, fake it, place 4 colors to send 'the first 4 colors to the legend, and after 'send the really values which could be repeated 'without change the colors in the legend. 'begining fake 'faking red machine1 'the "4" shows the number of legends .Color(0) = RGB(255, 0, 0) 'red 'faking green machine1 .Color(1) = RGB(0, 255, 0) 'green 'faking purple machine1 .Color(2) = RGB(200, 0, 255) 'purple 'faking blue machine1 .Color(3) = RGB(100, 100, 255) 'blue '---------- 'begining to send true values/colors .Legend(0) = "Machine 1" .Series(4).YFrom(0) = Today .Series(4).Yvalue(0) = Today + 10 'the color of every series.color legend 'will be defined by the first chartfx1.legend .Color(4) = RGB(255, 0, 0) .Series(5).YFrom(0) = Today + 20 .Series(5).Yvalue(0) = Today + 30 'the color of every series.color legend 'will be defined by the first chartfx1.legend .Color(5) = RGB(200, 0, 255) .Series(6).YFrom(0) = Today + 40 .Series(6).Yvalue(0) = Today + 50 'the color of every series.color legend 'will be defined by the first chartfx1.legend .Color(6) = RGB(255, 0, 0) .Series(7).YFrom(0) = Today + 60 .Series(7).Yvalue(0) = Today + 70 'the color of every series.color legend 'will be defined by the first chartfx1.legend .Color(7) = RGB(200, 0, 255) .Series(8).YFrom(0) = Today + 80 .Series(8).Yvalue(0) = Today + 90 'the color of every series.color legend 'will be defined by the first chartfx1.legend .Color(8) = RGB(0, 255, 0) .Series(9).YFrom(0) = Today + 100 .Series(9).Yvalue(0) = Today + 110 'the color of every series.color legend 'will be defined by the first chartfx1.legend .Color(9) = RGB(100, 100, 255) .CloseData COD_COLORS .CloseData COD_VALUES .CloseData COD_INIVALUES .Series(0).Legend = "Off" .Series(1).Legend = "On" .Series(2).Legend = "Down" .Series(3).Legend = "Starved" '====================================================== Regards, Boca Raton, FL. USA Tech Support: (561) 392-2023, Ext. 207 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.