I want to add a customized Label at customized position in XY chart in chartdirector in C++. For example, add a number label at (20, 40) on the plotarea.
// Create a XYChart object of size 740 x 760 pixels
XYChart* c = new XYChart(740, 760);
// Set the plotarea at (45, 25) and of size 680 x 680 pixels, with a light grey border
// (0xc0c0c0). Turn on both horizontal and vertical grid lines with light grey color (0xc0c0c0)
c->setPlotArea(45, 25, 680, 680, -1, -1, 0xc0c0c0, 0xc0c0c0, -1);
// Add a title to the chart using 18pt Times Bold Itatic font.
c->addTitle("X-Y Scatter Plot", "timesbi.ttf", 10);
// Add a title to the y axis using 12pt Arial Bold Italic font
c->yAxis()->setTitle("Y Distance (m)", "arialbi.ttf", 8);
// Add a title to the y axis using 12pt Arial Bold Italic font
c->xAxis()->setTitle("X Distance (m)", "arialbi.ttf", 8);
// Set the axes line width to 3 pixels
c->xAxis()->setWidth(2);
c->yAxis()->setWidth(2);
// Set the x and y axis to scale
c->xAxis()->setLinearScale((set_xy_range + margin_distance) * (-1), set_xy_range + margin_distance, set_xy_range_r);
c->yAxis()->setLinearScale((set_xy_range + margin_distance) * (-1), set_xy_range + margin_distance, set_xy_range_r);
XYChartView.setChart(c);
Can you please advice?
Added optional
setAlignment
.