Project

General

Profile

Feature #1608

chart improvements

Added by Jan HrubeŇ° almost 10 years ago. Updated almost 10 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
12/17/2012
Due date:
% Done:

0%

Estimated time:

Description

Hi,

I'm missing few features in Wt::Chart.

1) WDataSeries can show data point labels with setLabelsEnabled. The labels are painted directly in the chart. My series contains many points so they are rendered quite dense and labels are overlapping. Tooltip labels showing values only for the point under the mouse cursor (or when clicked) is better solution for a such case. However I have no idea if it is realistic with canvas or svg.

2) Programmer should be allowed use own format for WDataSeries label e.g."[; ]" .

3) There should be more then just two Y axes. Of course only the first and the second can be visible (show its ticks and labels). It will allow to plot more different series with different ranges.

4) I would like to use automatic limits of axes but I need to know the range before the chart is rendered (after changing the data). Functions minimum() and maximum() are useless because they will return old min/max at this point. I know global minimum and maximum of all series binded to the axis. What is the algorithm for calculating nice minimum and maximum (nice means rounded to 1,2,5 * (10n) depended to range for linear axis)? I have found some round*125 functions in WAxis.C in anonymous namespace. Could you make these functions static public? Or even better should be something similar to "double calculateNiceMinimumum(double minValue, double maxValue)".

regards,

Jan

#1

Updated by Jan HrubeŇ° almost 10 years ago

Another great feature would be order swapping of individual curves in graph to change z-axis order. In Matlab you can simple swap curve handlers in children vector to do this. In wt WObject::children() method returns const vector, so it can't be used directly and children_ is private of WObject. Using WObject::addChild() and WObject::removeChild() seems to be overhead for this. Can simple WObject::swapChildren(WObject *A, WObject *B) do any hurt? It can be useful when reordering widgets too.

// maybe return bool if swapping was successful
void WObject::swapChildren(WObject *A, WObject *B) 
{
    if ( A->parent_ != this || B->parent_ != this )
        throw WException("WObject::swapChildren() called with non-child");


    std::vector<WObject*>::iterator iBegin, iEnd, iA, iB;
    iBegin = children_->begin();
    iEnd = children_->end();

    // should optimize for one iteration over vector
    iA = std::find(iBegin, iEnd, A);
    iB = std::find(iBegin, iEnd, B);

    if ( (iA != iEnd) && (iB != iEnd) )
    {
        std::iter_swap(iA,iB);
    }
}

Also available in: Atom PDF