Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Scattergraph - How to set color for every single point

Hello, i want to draw the outer curved boundary of the cie xy diagramm and each point should have its own color. I have 2 Arrays one with die rgb color data for the diagramm (xycolor) and one with the xy coordinates. But every point gets the same color (i belive its the last one of the array xycolor),  if i try to append the points. The following Code shows my way to insert the colorpoints. Should i create for each point an scatterplot or is there another way to get an own color for every point (I have 1 Scattergraph with 1 Scatterplot at time)?

 

 

for(int i= 0; i<200; i++)
{
int r, g, b;

r = xycolor[i][0];
g = xycolor[i][1];
b = xycolor[i][2];

this->scatterPlot_MyPlot->PointColor = System::Drawing::Color::FromArgb(r,g,b);
this->scatterPlot_MyPlot->PlotXYAppend(xy[i][0],xy[i][1]);
}

 

 

0 Kudos
Message 1 of 3
(4,158 Views)

Hi Jeschki

 

you can only change the color of the whole plot. So you have to create a separate plot for every point.

Perhaps you can also use an intensity graph which is a 3D Graph Active X control.

You find an example here: http://sine.ni.com/devzone/cda/epd/p/id/1050

Regards
DianaS
0 Kudos
Message 2 of 3
(4,129 Views)

I got a solution now, but i don´t  believe it´s perfect. My solution is to create in every loop cycle an instance of scatterplot and add this instance to the scattergraph.

Maybe has someone another / better solution to solve this problem?

 

 

for(int i=0; i<200; i++)

{

NationalInstruments::UI::ScatterPlot^ scatter = gcnew NationalInstruments::UI::ScatterPlot();
scatter->XAxis = this->xAxis_scatter;//Main axis
scatter->YAxis = this->yAxis_scatter;
scatter->AntiAliased = true;
scatter->PointSize = System::Drawing::Size(3, 3);
scatter->PointStyle = NationalInstruments::UI::PointStyle::SolidCircle;
this->scatterGraph->Plots->AddRange(gcnew cli::array< NationalInstruments::UI::ScatterPlot^ >(1) {scatter});

r = xycolor[i][0];
g = xycolor[i][1];
b = xycolor[i][2];

 

scatter->PointColor = System::Drawing::Color::FromArgb(r,g,b);

scatter->PlotXYAppend(xy[i][0],xy[i][1]);

}

 

 

 

0 Kudos
Message 3 of 3
(4,128 Views)