[B<-S>|B<--step> I<seconds>]
The start and end of the time series you would like to display, and which
-B<RRA> the data should come from. Defaults are: 1 day ago until
-now, with the best possible resolution. B<Start> and B<end> can
-be specified in several formats, see
-L<rrdfetch> and L<rrdgraph_examples>.
-By default, B<rrdtool graph> calculates the width of one pixel in
-the time domain and tries to get data from an B<RRA> with that
-resolution. With the B<step> option you can alter this behaviour.
-If you want B<rrdtool graph> to get data at a one-hour resolution
-from the B<RRD>, set B<step> to 3'600. Note: a step smaller than
-one pixel will silently be ignored.
+B<RRA> the data should come from. Defaults are: 1 day ago until now, with
+the best possible resolution. B<Start> and B<end> can be specified in
+several formats, see L<rrdfetch> and L<rrdgraph_examples>. By default,
+B<rrdtool graph> calculates the width of one pixel in the time domain and
+tries to get data from an B<RRA> with that resolution. With the B<step>
+option you can alter this behaviour. If you want B<rrdtool graph> to get
+data at a one-hour resolution from the B<RRD>, set B<step> to 3'600. Note: a
+step smaller than one pixel will silently be ignored.
=item Labels
[B<--right-axis-label> I<label>]
A second axis will be drawn to the right of the graph. It is tied to the
-left axis via the scale and shift parameters. You can also define a label for the right axis.
+left axis via the scale and shift parameters. You can also define a label
+for the right axis.
+
+[B<--right-axis-format> I<format-string>]
+
+By default the format of the axis lables gets determined automatically. If
+you want todo this your self, use this option with the same %lf arguments
+you know from the PRING and GPRINT commands.
=item Size
nlabels++;
if (im->second_axis_scale != 0){
char graph_label_right[100];
- double sval = im->ygrid_scale.gridstep*(double)i/im->second_axis_scale+im->second_axis_shift;
- if (!second_axis_magfact){
- double dummy = im->ygrid_scale.gridstep*(double)(sgrid+egrid)/2.0/im->second_axis_scale+im->second_axis_shift;
+ double sval = im->ygrid_scale.gridstep*(double)i*im->second_axis_scale+im->second_axis_shift;
+ if (im->second_axis_format[0] == '\0'){
+ if (!second_axis_magfact){
+ double dummy = im->ygrid_scale.gridstep*(double)(sgrid+egrid)/2.0*im->second_axis_scale+im->second_axis_shift;
auto_scale(im,&dummy,&second_axis_symb,&second_axis_magfact);
- }
- sval /= second_axis_magfact;
+ }
+ sval /= second_axis_magfact;
- if(MaxY < 10) {
- sprintf(graph_label_right,"%5.1f %s",sval,second_axis_symb);
- } else {
- sprintf(graph_label_right,"%5.0f %s",sval,second_axis_symb);
+ if(MaxY < 10) {
+ sprintf(graph_label_right,"%5.1f %s",sval,second_axis_symb);
+ } else {
+ sprintf(graph_label_right,"%5.0f %s",sval,second_axis_symb);
+ }
}
+ else {
+ sprintf(graph_label_right,im->second_axis_format,sval);
+ }
gfx_new_text ( im->canvas,
X1+7, Y0,
im->graph_col[GRC_FONT],
}
if (im->second_axis_scale != 0){
char graph_label_right[100];
- if (im->extra_flags & FORCE_UNITS_SI) {
- double sval = value/im->second_axis_scale+im->second_axis_shift;
- double mfac = 1;
- char *symb = "";
- auto_scale(im,&sval,&symb,&mfac);
- sprintf(graph_label_right,"%4.0f %s", sval,symb);
- }
- else {
- sprintf(graph_label_right,"%3.0e", value/im->second_axis_scale+im->second_axis_shift);
+ double sval = value*im->second_axis_scale+im->second_axis_shift;
+ if (im->second_axis_format[0] == '\0'){
+ if (im->extra_flags & FORCE_UNITS_SI) {
+ double mfac = 1;
+ char *symb = "";
+ auto_scale(im,&sval,&symb,&mfac);
+ sprintf(graph_label_right,"%4.0f %s", sval,symb);
+ }
+ else {
+ sprintf(graph_label_right,"%3.0e", sval);
+ }
}
+ else {
+ sprintf(graph_label_right,im->second_axis_format,sval);
+ }
+
gfx_new_text ( im->canvas,
X1+7, Y0,
im->graph_col[GRC_FONT],
im->second_axis_scale = 0; /* 0 disables it */
im->second_axis_shift = 0; /* no shift by default */
im->second_axis_legend[0] = '\0';
+ im->second_axis_format[0] = '\0';
im->title[0] = '\0';
im->watermark[0] = '\0';
im->minval = DNAN;
{"disable-rrdtool-tag", no_argument, 0, 1001},
{"right-axis", required_argument, 0, 1002},
{"right-axis-label", required_argument, 0, 1003},
+ {"right-axis-format", required_argument, 0, 1004},
{0,0,0,0}};
int option_index = 0;
int opt;
strncpy(im->second_axis_legend,optarg,150);
im->second_axis_legend[150]='\0';
break;
+ case 1004:
+ if (bad_format(optarg)){
+ rrd_set_error("use either %le or %lf formats");
+ return;
+ }
+ strncpy(im->second_axis_format,optarg,150);
+ im->second_axis_format[150]='\0';
+ break;
case 'v':
strncpy(im->ylegend,optarg,150);
im->ylegend[150]='\0';