Jump to content
Software FX Community

Multicolor Graph - RealTime

User (Legacy)

Recommended Posts


I am using version 6.0.839.0 ChartFx for .NET under VS2005. I am having

trouble coloring each bar with unique color based on certin events. I did

enable the Multicolor to true. In this example I am trying to set color of

each bar as green (This will chnage to other colors on other logic). What I

am seeing is that bars are beeing added but they are all random colors....

Below are three section from my code. generated from Designer, on Form Load

and then adding each point.

Is this a bug? Or am I missing something?

Here is the code autogen by designer

this.chartAckTime.AllowEdit = false;

this.chartAckTime.AutoSizeMode =


this.chartAckTime.AutoValidate =


this.chartAckTime.AxisY.Gridlines = true;

this.chartAckTime.AxisY.LabelsFormat.Format =


this.chartAckTime.AxisY.Title.Text = "Ack Time in ms";

this.chartAckTime.BorderEffect =


this.chartAckTime.Dock = System.Windows.Forms.DockStyle.Fill;

this.chartAckTime.Location = new System.Drawing.Point(0, 0);

this.chartAckTime.MultipleColors = true;

this.chartAckTime.Name = "chartAckTime";

this.chartAckTime.NSeries = 1;

this.chartAckTime.PointLabelAngle = ((short)(45));

this.chartAckTime.PointLabels = true;

this.chartAckTime.Scheme = SoftwareFX.ChartFX.Scheme.Solid;

this.chartAckTime.Size = new System.Drawing.Size(310, 260);

this.chartAckTime.SmoothFlags =


this.chartAckTime.Stacked = SoftwareFX.ChartFX.Stacked.Normal;

this.chartAckTime.TabIndex = 0;

this.chartAckTime.Load += new


This is pice of code in Form::Load()

this.chartAckTime.RealTimeSettings.BufferSize = bufferSize;

this.chartAckTime.OpenData( COD.Values | COD.Remove | COD.AllocHidden, 1,


for(int i = 0; i< bufferSize - 1; i++)

this.chartAckTime.Legend[i] = (i + 1).ToString();

this.chartAckTime.CloseData(COD.Values | COD.Remove | COD.AllocHidden);

//Set the Max and Min since no data was passed.

this.chartAckTime.AxisY.Max = 20;

this.chartAckTime.AxisY.Min = 0;

//Optimize scrolling. These lines will make the chart scroll faster.

this.chartAckTime.TypeMask = this.chartAckTime.TypeMask |


this.chartAckTime.TypeEx = this.chartAckTime.TypeEx |


this.chartAckTime.RealTimeSettings.Style = RealTimeStyle.NoWaitArrow |


And this is How I add each point

// Switch real-time styles once buffer is full

if( this.nOffset == this.bufferSize )


this.chartAckTime.RealTimeSettings.Style =




//Set Communication Channel styles

//These COD values instruct Chart FX about the Realtime settings

//the chart, values and legend.

SoftwareFX.ChartFX.COD nCOD;

nCOD = COD.Values | COD.RealTime | COD.ScrollLegend | COD.Values |

COD.AddPoints | COD.Colors;

//Add a point for each sereis to the right of the chart

//Using the legend property, set the legend values

this.chartAckTime.OpenData(nCOD, 1, 1);

this.chartAckTime.Value[0, 0] = time;

this.chartAckTime.Point[0, 0].Color = System.Drawing.Color.Green;

this.chartAckTime.Legend[0] = (nOffset + 1).ToString();

this.chartAckTime.CloseData(nCOD | COD.RealTimeScroll);

nOffset = nOffset + 1;

Link to comment
Share on other sites


The problem here is that you are trying to mix two concepts that don't mix

very well: Real-Time and Per-Point attributes.

The basis for Real-Time charts is that points are only added to the chart,

they are added to a circular buffer.

Per-Point attributes are attached to the index of a point regardless where

this point is in the circular buffer. For example, if a per-point attribute

is added for point 2, after the buffer becomes full and 3 more points are

added, the last point will acquire the per-point attributes of point 2, in

other words the point attributes of the point going out are taken in by the

point coming in.

Unlike, Value and Legend, the index of Point is NOT relative to the

OpenData(COD_AddPoint) statement, instead you need to address this point by

its real index:

this.chartAckTime.Point[0, nOffset % BufferSize].Color =



Francisco Padron


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...