User (Legacy) Posted February 22, 2002 Report Share Posted February 22, 2002 Hello! I am having problems producing the legend box for a chart. My chart has 2 series. Series 0 is a bar chart and series 1 is a line chart. I have coloured each point in series 0 using my own code along with the values property. To do this I simply set a counter to 0, colour the point, and increment the counter by 2, because I want to leave the colour of series 1 alone. This code is working fine. My problem now is getting a legend box to appear. I am trying to use the code given in a KB article, shown below, to construct the legend box. This code works fine with 1 series but not with 2. How can I do this? ChartFX1.MultipleColors = True nFirstRed = -1 ' Locate first RED bar nFirstBlue = -1 ' Locate first BLUE bar ChartFX1.OpenDataEx COD_VALUES, 1, NumberOfPoints ChartFX1.OpenDataEx COD_COLORS, NumberOfPoints, 0 For i = 0 To NumberOfPoints - 1 dValue = Rnd * 100 ChartFX1.ValueEx(0, i) = dValue If dValue > 50 Then ChartFX1.Color(i) = RGB(255, 0, 0) If nFirstRed = -1 Then nFirstRed = i Else ChartFX1.Color(i) = RGB(0, 0, 255) If nFirstBlue = -1 Then nFirstBlue = i End If ChartFX1.KeyLeg(i) = Str(i+1) ' X-axis label Next i ChartFX1.CloseData COD_VALUES ChartFX1.CloseData COD_COLORS ' Show legend If nFirstRed <> -1 Then ChartFX1.Legend(nFirstRed) = "Greater than 50" If nFirstBlue <> -1 Then ChartFX1.Legend(nFirstBlue) = "Lesser than 50" ChartFX1.LegendBoxObj.SkipEmpty = True ' Show only these two ChartFX1.LegendBox = True Cheers Paul Link to comment Share on other sites More sharing options...
User (Legacy) Posted February 25, 2002 Author Report Share Posted February 25, 2002 Paul, The following is code that I created based off of the code you posted. Since you didn't post the code that didn't work, it's hard to tell what you were doing incorrectly. The code here creates two series and displays the legend that is created. I don't know if your problem was that it wasn't displaying the legend box at all or that it was displaying it incorrectly. I never had a problem with it not displaying, but I did with it displaying incorrectly. I fixed that problem. One thing to note, the COD_VALUES is two dimensional while COD_COLORS is one-d. The point is that when you set the colors on a multiple series graph, you have to map the two d coordinate into a one dimensional array. This is done with the following formula: seriesNum+columnNum*seriesNum. Hope this kind-of explanation and the following code helps. <!-- #include virtual="/Include/CfxIE.inc" --> <% Set ChartFX1 = Server.CreateObject("ChartFX.WebServer") 'Define dimensions NumberOfPoints = 10 NumSeries = 2 'Allow for individual point color assignments 'NOTE: once set, if you want an entire series to be the same color 'you have to manually assign that color to each point ChartFX1.MultipleColors = True 'Personal preference - I don't like the 3d look on line charts ChartFX1.Chart3D = False nFirstRed = -1 ' Locate first RED bar nFirstBlue = -1 ' Locate first BLUE bar 'Seed the random function to get truly (well, pseudo) random results Randomize ChartFX1.OpenDataEx COD_VALUES, numSeries, NumberOfPoints ChartFX1.OpenDataEx COD_COLORS, NumberOfPoints*numSeries, 0 For j = 0 To numSeries - 1 For i = 0 To NumberOfPoints - 1 dValue = Rnd * 100 ChartFX1.ValueEx(j, i) = dValue if (j =0) then If dValue > 50 Then ChartFX1.Color(j+numSeries*i) = RGB(255, 0, 0) If nFirstRed = -1 Then nFirstRed = j+numSeries*i Else ChartFX1.Color(j+numSeries*i) = RGB(0, 0, 255) If nFirstBlue = -1 Then nFirstBlue = j+numSeries*i End If ChartFX1.KeyLeg(i) = CStr(i+1) ' X-axis label else ChartFX1.Color(j+numSeries*i) = RGB(0, 200, 0) end if Next Next ChartFX1.CloseData COD_VALUES ChartFX1.CloseData COD_COLORS ChartFX1.Series(1).Gallery = LINES ' Show legend If nFirstRed <> -1 Then ChartFX1.Legend(nFirstRed) = "Greater than 50" If nFirstBlue <> -1 Then ChartFX1.Legend(nFirstBlue) = "Lesser than 50" ChartFX1.LegendBoxObj.SkipEmpty = True ' Show only these two ChartFX1.LegendBox = True Response.Write ChartFX1.GetHtmlTag(300,300, "Image") %> Let me know if you have any further questions. If you do, please give an example of code that DOESN'T work. Thanks. Chris "Paul Saxton" <paul.saxton@stcenergy.com> wrote in message news:j4G2IA8uBHA.1412@webserver1.softwarefx.com... > Hello! > > I am having problems producing the legend box for a chart. My chart has 2 > series. Series 0 is a bar chart and series 1 is a line chart. I have > coloured each point in series 0 using my own code along with the values > property. To do this I simply set a counter to 0, colour the point, and > increment the counter by 2, because I want to leave the colour of series 1 > alone. This code is working fine. My problem now is getting a legend box to > appear. I am trying to use the code given in a KB article, shown below, to > construct the legend box. This code works fine with 1 series but not with 2. > How can I do this? > > ChartFX1.MultipleColors = True > > nFirstRed = -1 ' Locate first RED bar > > nFirstBlue = -1 ' Locate first BLUE bar > > ChartFX1.OpenDataEx COD_VALUES, 1, NumberOfPoints > > ChartFX1.OpenDataEx COD_COLORS, NumberOfPoints, 0 > > For i = 0 To NumberOfPoints - 1 > > dValue = Rnd * 100 > > ChartFX1.ValueEx(0, i) = dValue > > If dValue > 50 Then > > ChartFX1.Color(i) = RGB(255, 0, 0) > > If nFirstRed = -1 Then nFirstRed = i > > Else > > ChartFX1.Color(i) = RGB(0, 0, 255) > > If nFirstBlue = -1 Then nFirstBlue = i > > End If > > ChartFX1.KeyLeg(i) = Str(i+1) ' X-axis label > > Next i > > ChartFX1.CloseData COD_VALUES > > ChartFX1.CloseData COD_COLORS > > ' Show legend > > If nFirstRed <> -1 Then ChartFX1.Legend(nFirstRed) = "Greater than 50" > > If nFirstBlue <> -1 Then ChartFX1.Legend(nFirstBlue) = "Lesser than 50" > > ChartFX1.LegendBoxObj.SkipEmpty = True ' Show only these two > > ChartFX1.LegendBox = True > > Cheers > > Paul > > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted February 27, 2002 Author Report Share Posted February 27, 2002 Hi Chris! Sorry for not posting code that did not work the other day. Thanks for your code. However, I have a problem with it. When I adapt my colouring code to use your method, it works fine for one series but only colours half of the graph for the 2 series. Before I continue, I will give an explanation of what I am trying to do. I have an array of numbers that relate to information for a range of days. Each day contains a number of periods (in time), in this case, night, other, peak and Evening. Each of these periods has its own set colour. An additional period, weekend, covers the weekend colour. My colour code colours each column in my chart according to the period of a day that the column is relevant to. Our system needs to take account of a varying number of periods. For this reason, the first of each colour is stored in a dynamic array. The code is attached. I have taken as much of the code out as possible to make it as simple as I can. There is still a lot of code in the file that I attach, but please note that about 75% is just needed to create the graph and can be ignored. I have put a "please ignore" line into the code, anything below that line can be ignored as there is no problem with it. I have commented the code as well. I used the formula that you gave me to colour the columns, as the series I want to colour is always going to be 0 I left out the "SeriesNum+" part of the formula. I really hope that you or someone else can help me Cheers Paul Attachments.zip Link to comment Share on other sites More sharing options...
User (Legacy) Posted February 27, 2002 Author Report Share Posted February 27, 2002 Paul, Your problem is when you open COD_COLORS, you use nTotalRecs. However, you don't modify nTotalRecs if bIncludPrecition is true. In you sub FillArray, I added modified the code as follows: ... nTotalRecs = 47 if bIncludePredition then nNumOfSeries = 2 nTotalRecs = nTotalRecs * 2 'ADDED THIS LINE DoPrecition else nNumOfSeries = 1 end if .... What happened was that you were only opening 47 color entries, but when you went to set the colors, you were using (nNumOfSeries * nCurrentPos) as the index. So when bIncludePredition was true, nNumOfSeries = 2 and if you were on position 30, the index would 60 - which is greater than the 47 color entries you were opening causing the color not to be assigned. I hope this helps and hasn't confused you. Chris "Paul Saxton" <paul.saxton@stcenergy.com> wrote in message news:Q41AXa6vBHA.2668@webserver1.softwarefx.com... > Hi Chris! > > Sorry for not posting code that did not work the other day. Thanks for your > code. However, I have a problem with it. When I adapt my colouring code to > use your method, it works fine for one series but only colours half of the > graph for the 2 series. > > Before I continue, I will give an explanation of what I am trying to do. I > have an array of numbers that relate to information for a range of days. > Each day contains a number of periods (in time), in this case, night, other, > peak and Evening. Each of these periods has its own set colour. An > additional period, weekend, covers the weekend colour. My colour code > colours each column in my chart according to the period of a day that the > column is relevant to. Our system needs to take account of a varying number > of periods. For this reason, the first of each colour is stored in a > dynamic array. > > The code is attached. I have taken as much of the code out as possible to > make it as simple as I can. There is still a lot of code in the file that I > attach, but please note that about 75% is just needed to create the graph > and can be ignored. I have put a "please ignore" line into the code, > anything below that line can be ignored as there is no problem with it. I > have commented the code as well. > > I used the formula that you gave me to colour the columns, as the series I > want to colour is always going to be 0 I left out the "SeriesNum+" part of > the formula. > > I really hope that you or someone else can help me > > Cheers > > Paul > > > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted February 27, 2002 Author Report Share Posted February 27, 2002 Thanks Chris! Now I have hit a second problem, which you should be able to see as well, why has ChartFX only picked up 2 out of the 4 legend boxes? Cheers Paul "Chris Taylor" <ctaylor@belltechlogix.com> wrote in message news:hQdPx26vBHA.2668@webserver1.softwarefx.com... > Paul, > > Your problem is when you open COD_COLORS, you use nTotalRecs. However, you > don't modify nTotalRecs if bIncludPrecition is true. In you sub FillArray, > I added modified the code as follows: > > ... > nTotalRecs = 47 > if bIncludePredition then > nNumOfSeries = 2 > nTotalRecs = nTotalRecs * 2 'ADDED THIS LINE > DoPrecition > else > nNumOfSeries = 1 > end if > .... > > What happened was that you were only opening 47 color entries, but when you > went to set the colors, you were using (nNumOfSeries * nCurrentPos) as the > index. So when bIncludePredition was true, nNumOfSeries = 2 and if you were > on position 30, the index would 60 - which is greater than the 47 color > entries you were opening causing the color not to be assigned. > > I hope this helps and hasn't confused you. > > Chris > > "Paul Saxton" <paul.saxton@stcenergy.com> wrote in message > news:Q41AXa6vBHA.2668@webserver1.softwarefx.com... > > Hi Chris! > > > > Sorry for not posting code that did not work the other day. Thanks for > your > > code. However, I have a problem with it. When I adapt my colouring code > to > > use your method, it works fine for one series but only colours half of the > > graph for the 2 series. > > > > Before I continue, I will give an explanation of what I am trying to do. > I > > have an array of numbers that relate to information for a range of days. > > Each day contains a number of periods (in time), in this case, night, > other, > > peak and Evening. Each of these periods has its own set colour. An > > additional period, weekend, covers the weekend colour. My colour code > > colours each column in my chart according to the period of a day that the > > column is relevant to. Our system needs to take account of a varying > number > > of periods. For this reason, the first of each colour is stored in a > > dynamic array. > > > > The code is attached. I have taken as much of the code out as possible to > > make it as simple as I can. There is still a lot of code in the file that > I > > attach, but please note that about 75% is just needed to create the graph > > and can be ignored. I have put a "please ignore" line into the code, > > anything below that line can be ignored as there is no problem with it. I > > have commented the code as well. > > > > I used the formula that you gave me to colour the columns, as the series I > > want to colour is always going to be 0 I left out the "SeriesNum+" part of > > the formula. > > > > I really hope that you or someone else can help me > > > > Cheers > > > > Paul > > > > > > > > > > ChartFailure.ZIP Link to comment Share on other sites More sharing options...
User (Legacy) Posted February 27, 2002 Author Report Share Posted February 27, 2002 To fix the problem of showing only 2 legend boxes, make the following change in Sub GMTColour: Change the line: if aLegends(nCount)<>-1 then cfxChart1.Legend(aLegends(nCount))=aPeriodNames(nCount) To if aLegends(nCount)<>-1 then cfxChart1.Legend(aLegends(nCount)/nNumOfSeries)=aPeriodNames(nCount) The reason is that the index for Legend is based on the x-value, not the total number of points. You set the value of aLegends equal to the position in the COLOR array (nNumOfSeries * nCurrentPos). However, you really only need "nCurrentPos" as the index into Legend. That fixes the problem of showing only 2 legends. However, I'm still getting an error - the colors don't match up with the bars. This is really weird. You might want to actually try an official SoftwareFX person and see if they might know why it is doing this. I've tried several things, but have not been able to get the colors to match (except to turn the prediction off). I'll continue to play with it and will let you know if I find a solution. Chris "Paul Saxton" <paul.saxton@stcenergy.com> wrote in message news:SnIIp66vBHA.1412@webserver1.softwarefx.com... > Thanks Chris! > > Now I have hit a second problem, which you should be able to see as well, > why has ChartFX only picked up 2 out of the 4 legend boxes? > > Cheers > > Paul > > "Chris Taylor" <ctaylor@belltechlogix.com> wrote in message > news:hQdPx26vBHA.2668@webserver1.softwarefx.com... > > Paul, > > > > Your problem is when you open COD_COLORS, you use nTotalRecs. However, > you > > don't modify nTotalRecs if bIncludPrecition is true. In you sub > FillArray, > > I added modified the code as follows: > > > > ... > > nTotalRecs = 47 > > if bIncludePredition then > > nNumOfSeries = 2 > > nTotalRecs = nTotalRecs * 2 'ADDED THIS LINE > > DoPrecition > > else > > nNumOfSeries = 1 > > end if > > .... > > > > What happened was that you were only opening 47 color entries, but when > you > > went to set the colors, you were using (nNumOfSeries * nCurrentPos) as the > > index. So when bIncludePredition was true, nNumOfSeries = 2 and if you > were > > on position 30, the index would 60 - which is greater than the 47 color > > entries you were opening causing the color not to be assigned. > > > > I hope this helps and hasn't confused you. > > > > Chris > > > > "Paul Saxton" <paul.saxton@stcenergy.com> wrote in message > > news:Q41AXa6vBHA.2668@webserver1.softwarefx.com... > > > Hi Chris! > > > > > > Sorry for not posting code that did not work the other day. Thanks for > > your > > > code. However, I have a problem with it. When I adapt my colouring > code > > to > > > use your method, it works fine for one series but only colours half of > the > > > graph for the 2 series. > > > > > > Before I continue, I will give an explanation of what I am trying to do. > > I > > > have an array of numbers that relate to information for a range of days. > > > Each day contains a number of periods (in time), in this case, night, > > other, > > > peak and Evening. Each of these periods has its own set colour. An > > > additional period, weekend, covers the weekend colour. My colour code > > > colours each column in my chart according to the period of a day that > the > > > column is relevant to. Our system needs to take account of a varying > > number > > > of periods. For this reason, the first of each colour is stored in a > > > dynamic array. > > > > > > The code is attached. I have taken as much of the code out as possible > to > > > make it as simple as I can. There is still a lot of code in the file > that > > I > > > attach, but please note that about 75% is just needed to create the > graph > > > and can be ignored. I have put a "please ignore" line into the code, > > > anything below that line can be ignored as there is no problem with it. > I > > > have commented the code as well. > > > > > > I used the formula that you gave me to colour the columns, as the series > I > > > want to colour is always going to be 0 I left out the "SeriesNum+" part > of > > > the formula. > > > > > > I really hope that you or someone else can help me > > > > > > Cheers > > > > > > Paul > > > > > > > > > > > > > > > > > > Link to comment Share on other sites More sharing options...
User (Legacy) Posted February 27, 2002 Author Report Share Posted February 27, 2002 Thanks a lot for your help Chris, will ask Software FX. Cheers Paul "Chris Taylor" <ctaylor@belltechlogix.com> wrote in message news:zPtJW57vBHA.1412@webserver1.softwarefx.com... > To fix the problem of showing only 2 legend boxes, make the following change > in Sub GMTColour: > > Change the line: > > if aLegends(nCount)<>-1 then > cfxChart1.Legend(aLegends(nCount))=aPeriodNames(nCount) > > To > > if aLegends(nCount)<>-1 then > cfxChart1.Legend(aLegends(nCount)/nNumOfSeries)=aPeriodNames(nCount) > > The reason is that the index for Legend is based on the x-value, not the > total number of points. You set the value of aLegends equal to the position > in the COLOR array (nNumOfSeries * nCurrentPos). However, you really only > need "nCurrentPos" as the index into Legend. > > That fixes the problem of showing only 2 legends. However, I'm still > getting an error - the colors don't match up with the bars. This is really > weird. You might want to actually try an official SoftwareFX person and see > if they might know why it is doing this. I've tried several things, but > have not been able to get the colors to match (except to turn the prediction > off). I'll continue to play with it and will let you know if I find a > solution. > > Chris > > > "Paul Saxton" <paul.saxton@stcenergy.com> wrote in message > news:SnIIp66vBHA.1412@webserver1.softwarefx.com... > > Thanks Chris! > > > > Now I have hit a second problem, which you should be able to see as well, > > why has ChartFX only picked up 2 out of the 4 legend boxes? > > > > Cheers > > > > Paul > > > > "Chris Taylor" <ctaylor@belltechlogix.com> wrote in message > > news:hQdPx26vBHA.2668@webserver1.softwarefx.com... > > > Paul, > > > > > > Your problem is when you open COD_COLORS, you use nTotalRecs. However, > > you > > > don't modify nTotalRecs if bIncludPrecition is true. In you sub > > FillArray, > > > I added modified the code as follows: > > > > > > ... > > > nTotalRecs = 47 > > > if bIncludePredition then > > > nNumOfSeries = 2 > > > nTotalRecs = nTotalRecs * 2 'ADDED THIS LINE > > > DoPrecition > > > else > > > nNumOfSeries = 1 > > > end if > > > .... > > > > > > What happened was that you were only opening 47 color entries, but when > > you > > > went to set the colors, you were using (nNumOfSeries * nCurrentPos) as > the > > > index. So when bIncludePredition was true, nNumOfSeries = 2 and if you > > were > > > on position 30, the index would 60 - which is greater than the 47 color > > > entries you were opening causing the color not to be assigned. > > > > > > I hope this helps and hasn't confused you. > > > > > > Chris > > > > > > "Paul Saxton" <paul.saxton@stcenergy.com> wrote in message > > > news:Q41AXa6vBHA.2668@webserver1.softwarefx.com... > > > > Hi Chris! > > > > > > > > Sorry for not posting code that did not work the other day. Thanks > for > > > your > > > > code. However, I have a problem with it. When I adapt my colouring > > code > > > to > > > > use your method, it works fine for one series but only colours half of > > the > > > > graph for the 2 series. > > > > > > > > Before I continue, I will give an explanation of what I am trying to > do. > > > I > > > > have an array of numbers that relate to information for a range of > days. > > > > Each day contains a number of periods (in time), in this case, night, > > > other, > > > > peak and Evening. Each of these periods has its own set colour. An > > > > additional period, weekend, covers the weekend colour. My colour code > > > > colours each column in my chart according to the period of a day that > > the > > > > column is relevant to. Our system needs to take account of a varying > > > number > > > > of periods. For this reason, the first of each colour is stored in a > > > > dynamic array. > > > > > > > > The code is attached. I have taken as much of the code out as > possible > > to > > > > make it as simple as I can. There is still a lot of code in the file > > that > > > I > > > > attach, but please note that about 75% is just needed to create the > > graph > > > > and can be ignored. I have put a "please ignore" line into the code, > > > > anything below that line can be ignored as there is no problem with > it. > > I > > > > have commented the code as well. > > > > > > > > I used the formula that you gave me to colour the columns, as the > series > > I > > > > want to colour is always going to be 0 I left out the "SeriesNum+" > part > > of > > > > the formula. > > > > > > > > I really hope that you or someone else can help me > > > > > > > > Cheers > > > > > > > > Paul > > > > > > > > > > > > > > > > > > > > > > > > > > > > Link to comment Share on other sites More sharing options...
Software FX Posted February 28, 2002 Report Share Posted February 28, 2002 The legend box code assumes 1 label per point, in order to paint a color box in it we use the color array as a 1-dimensional array so in your case we are picking the wrong color (it would work if your chart had 1 series). Your previous code cfxChart1.Legend(aLegends(nCount))=aPeriodNames(nCount) would give you the right colors but we limit the number of labels we paint the legend box to the number of points in the chart (that is why you only get two labels instead of 4). To workaround these issues you will have to use the Series Legend instead of Legend. We do not limit the number of labels painted in your series legend so it works fine. These are the code changes you will have to make At the end of GMTColour (Replace Legend with SerLeg and remove the division by numseries) for nCount=0 to UBound(aPeriodNames) cfxChart1.SerLeg(aLegends(nCount))=aPeriodNames(nCount) next In setBasicChartData (Replace LegendBox with SerLegBox and comment out the line that set the first series legend) ' cfxChart1.SerLeg(0)="Profile" cfxChart1.SerLegBoxObj.Docked = 258 cfxChart1.SerLegBoxObj.SkipEmpty=True cfxChart1.SerLegBoxObj.docked=TGFP_BOTTOM cfxChart1.SerLegBox = True I did not check the tooltip of the points which is the only thing that could get affected by this change but I think these changes will get you the chart you want. -- Regards JC Software FX Support "Paul Saxton" <psaxton@onetel.net.uk> wrote in message news:VQjEt8#vBHA.1412@webserver1.softwarefx.com... > Thanks a lot for your help Chris, will ask Software FX. > > Cheers > > Paul > > "Chris Taylor" <ctaylor@belltechlogix.com> wrote in message > news:zPtJW57vBHA.1412@webserver1.softwarefx.com... > > To fix the problem of showing only 2 legend boxes, make the following > change > > in Sub GMTColour: > > > > Change the line: > > > > if aLegends(nCount)<>-1 then > > cfxChart1.Legend(aLegends(nCount))=aPeriodNames(nCount) > > > > To > > > > if aLegends(nCount)<>-1 then > > cfxChart1.Legend(aLegends(nCount)/nNumOfSeries)=aPeriodNames(nCount) > > > > The reason is that the index for Legend is based on the x-value, not the > > total number of points. You set the value of aLegends equal to the > position > > in the COLOR array (nNumOfSeries * nCurrentPos). However, you really only > > need "nCurrentPos" as the index into Legend. > > > > That fixes the problem of showing only 2 legends. However, I'm still > > getting an error - the colors don't match up with the bars. This is > really > > weird. You might want to actually try an official SoftwareFX person and > see > > if they might know why it is doing this. I've tried several things, but > > have not been able to get the colors to match (except to turn the > prediction > > off). I'll continue to play with it and will let you know if I find a > > solution. > > > > Chris > > > > > > "Paul Saxton" <paul.saxton@stcenergy.com> wrote in message > > news:SnIIp66vBHA.1412@webserver1.softwarefx.com... > > > Thanks Chris! > > > > > > Now I have hit a second problem, which you should be able to see as > well, > > > why has ChartFX only picked up 2 out of the 4 legend boxes? > > > > > > Cheers > > > > > > Paul > > > > > > "Chris Taylor" <ctaylor@belltechlogix.com> wrote in message > > > news:hQdPx26vBHA.2668@webserver1.softwarefx.com... > > > > Paul, > > > > > > > > Your problem is when you open COD_COLORS, you use nTotalRecs. > However, > > > you > > > > don't modify nTotalRecs if bIncludPrecition is true. In you sub > > > FillArray, > > > > I added modified the code as follows: > > > > > > > > ... > > > > nTotalRecs = 47 > > > > if bIncludePredition then > > > > nNumOfSeries = 2 > > > > nTotalRecs = nTotalRecs * 2 'ADDED THIS LINE > > > > DoPrecition > > > > else > > > > nNumOfSeries = 1 > > > > end if > > > > .... > > > > > > > > What happened was that you were only opening 47 color entries, but > when > > > you > > > > went to set the colors, you were using (nNumOfSeries * nCurrentPos) as > > the > > > > index. So when bIncludePredition was true, nNumOfSeries = 2 and if > you > > > were > > > > on position 30, the index would 60 - which is greater than the 47 > color > > > > entries you were opening causing the color not to be assigned. > > > > > > > > I hope this helps and hasn't confused you. > > > > > > > > Chris > > > > > > > > "Paul Saxton" <paul.saxton@stcenergy.com> wrote in message > > > > news:Q41AXa6vBHA.2668@webserver1.softwarefx.com... > > > > > Hi Chris! > > > > > > > > > > Sorry for not posting code that did not work the other day. Thanks > > for > > > > your > > > > > code. However, I have a problem with it. When I adapt my colouring > > > code > > > > to > > > > > use your method, it works fine for one series but only colours half > of > > > the > > > > > graph for the 2 series. > > > > > > > > > > Before I continue, I will give an explanation of what I am trying to > > do. > > > > I > > > > > have an array of numbers that relate to information for a range of > > days. > > > > > Each day contains a number of periods (in time), in this case, > night, > > > > other, > > > > > peak and Evening. Each of these periods has its own set colour. An > > > > > additional period, weekend, covers the weekend colour. My colour > code > > > > > colours each column in my chart according to the period of a day > that > > > the > > > > > column is relevant to. Our system needs to take account of a > varying > > > > number > > > > > of periods. For this reason, the first of each colour is stored in > a > > > > > dynamic array. > > > > > > > > > > The code is attached. I have taken as much of the code out as > > possible > > > to > > > > > make it as simple as I can. There is still a lot of code in the > file > > > that > > > > I > > > > > attach, but please note that about 75% is just needed to create the > > > graph > > > > > and can be ignored. I have put a "please ignore" line into the > code, > > > > > anything below that line can be ignored as there is no problem with > > it. > > > I > > > > > have commented the code as well. > > > > > > > > > > I used the formula that you gave me to colour the columns, as the > > series > > > I > > > > > want to colour is always going to be 0 I left out the "SeriesNum+" > > part > > > of > > > > > the formula. > > > > > > > > > > I really hope that you or someone else can help me > > > > > > > > > > Cheers > > > > > > > > > > Paul > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.