sparkline.c: mov label-ini into the AddSample Function

This commit is contained in:
Sun He
2014-12-08 11:15:06 +08:00
parent 93eed9ae01
commit c87a37661e
2 changed files with 3 additions and 4 deletions

View File

@ -49,7 +49,7 @@ static int label_margin_top = 1;
* sparklineSequenceAddSample(seq, 10, NULL);
* sparklineSequenceAddSample(seq, 20, NULL);
* sparklineSequenceAddSample(seq, 30, "last sample label");
* sds output = sparklineRender(seq, 80, 4);
* sds output = sparklineRender(sdsempty(), seq, 80, 4, SPARKLINE_FILL);
* freeSparklineSequence(seq);
* ------------------------------------------------------------------------- */
@ -63,6 +63,7 @@ struct sequence *createSparklineSequence(void) {
/* Add a new sample into a sequence. */
void sparklineSequenceAddSample(struct sequence *seq, double value, char *label) {
label = label == NULL ? label : zstrdup(label);
if (seq->length == 0) {
seq->min = seq->max = value;
} else {