Hi,
I'm making a 2D Histogram (so instead of a bar graph, I need a bunch of tiled rectangles, each of a different color to represent its value). I'd like to know how I can draw rectangles of a user-defined size and place them on my graph.
my current code is ...
///////////////////////////
m_graph.Axes.Item(1).SetMinMax(minX, maxX); //x-axis
m_graph.Axes.Item(2).SetMinMax(minY, maxY); //y-axis
CNiAnnotation newAnnotation = m_graph.Annotations.Add();
newAnnotation.SnapMode = CNiAnnotation::SnapFixed;
newAnnotation.CoordinateType = CNiAnnotation::AxesCoordinates;
CNiShape shape = newAnnotation.Shape;
shape.Type = CNiShape:: Rectangle;
CNiReal64Vector xC,yC;
xC.Append(20); //random numbers to see what happens
yC.Append(2);
xC.Append(3);
yC.Append(5);
shape.SetCoordinates(xC,yC);
newAnnotation.Visible = true;
////////////////////////////////////
...but the SetCoordinates() function doesnt let you place the annotation based on the graph axes... and that's what i need to do. also... i'm going to have a LOT of annotations, so is there a way to create a variable # of annotations easily?
..or is there just an easier way to draw a bunch of colored rectangles to a graph? 😃
thanks,
Ryan