Copy the scale vector as well and attach it to the data vector.
Remove it again when the graph is destroyed.
This commit is contained in:
parent
f518766c66
commit
14b154f5f3
|
|
@ -319,7 +319,7 @@ void gr_point(struct dvec *dv,
|
||||||
switch (currentgraph->plottype) {
|
switch (currentgraph->plottype) {
|
||||||
double *tics;
|
double *tics;
|
||||||
case PLOT_LIN:
|
case PLOT_LIN:
|
||||||
case PLOT_MONOLIN:
|
case PLOT_RETLIN:
|
||||||
/* If it's a linear plot, ignore first point since we don't
|
/* If it's a linear plot, ignore first point since we don't
|
||||||
want to connect with oldx and oldy. */
|
want to connect with oldx and oldy. */
|
||||||
if (np)
|
if (np)
|
||||||
|
|
@ -421,32 +421,18 @@ static void gr_start_internal(struct dvec *dv, bool copyvec)
|
||||||
|
|
||||||
currentgraph->plotdata = link;
|
currentgraph->plotdata = link;
|
||||||
|
|
||||||
/* FIXME: this piece of code causes bug no. #472 */
|
/* Copy the scale vector, add it to the vector as v_scale
|
||||||
/* Add the scale vector to the list of vectors associated with the plot
|
|
||||||
* and use the copy instead of the original scale vector if requested */
|
* and use the copy instead of the original scale vector if requested */
|
||||||
{
|
{
|
||||||
struct dvec * const custom_scale = dv->v_scale;
|
struct dvec * const custom_scale = dv->v_scale;
|
||||||
if (custom_scale != (struct dvec *) NULL) {
|
if (custom_scale != (struct dvec*) NULL) {
|
||||||
link = TMALLOC(struct dveclist, 1);
|
|
||||||
link->next = currentgraph->plotdata;
|
|
||||||
|
|
||||||
if (copyvec) {
|
if (copyvec) {
|
||||||
link->vector = vec_copy(dv->v_scale);
|
currentgraph->plotdata->vector->v_scale = vec_copy(dv->v_scale);
|
||||||
link->vector->v_flags |= VF_PERMANENT;
|
currentgraph->plotdata->vector->v_scale->v_flags |= VF_PERMANENT;
|
||||||
link->next->vector->v_scale = link->vector;
|
|
||||||
link->f_own_vector = TRUE;
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
link->vector = dv->v_scale;
|
|
||||||
link->f_own_vector = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make the new vector the start of the list of vectors */
|
|
||||||
currentgraph->plotdata = link;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Put the legend entry on the screen. */
|
/* Put the legend entry on the screen. */
|
||||||
if (!cp_getvar("nolegend", CP_BOOL, NULL, 0))
|
if (!cp_getvar("nolegend", CP_BOOL, NULL, 0))
|
||||||
drawlegend(currentgraph, cur.plotno++, dv);
|
drawlegend(currentgraph, cur.plotno++, dv);
|
||||||
|
|
|
||||||
|
|
@ -259,6 +259,8 @@ int DestroyGraph(int id)
|
||||||
nextd = d->next;
|
nextd = d->next;
|
||||||
if (d->f_own_vector) {
|
if (d->f_own_vector) {
|
||||||
/* list responsible for freeing this vector */
|
/* list responsible for freeing this vector */
|
||||||
|
if (d->vector->v_scale)
|
||||||
|
dvec_free(d->vector->v_scale);
|
||||||
dvec_free(d->vector);
|
dvec_free(d->vector);
|
||||||
}
|
}
|
||||||
txfree(d);
|
txfree(d);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue