I have added three extra legends on my chart.
Two of them show the marks/labels/legend correctly
Only the first one gives problems.
It only shows 3 of the 4 labels.
When I add a fifth label it also shows 3 labels.
What's wrong?
Extra legend does not show the last mark
Extra legend does not show the last mark
- Attachments
-
- extralegendproblem.JPG (78.84 KiB) Viewed 54266 times
Re: Extra legend does not show the last mark
Hi Martin,
Could you please post the code you used to produce that chart?
Thanks in advance.
Could you please post the code you used to produce that chart?
Thanks in advance.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Extra legend does not show the last mark
Code: Select all
public function fill($labels,$series)
{
$labels = null;
$top = 700;
$left = 40;
foreach ($series as $serie) {
$bar = new ModalityHorzBar($this->chart,true,false,false,-5);
//waardes
foreach ($serie->getPoints() as $point) {
$value = $point->getValuesY();
$text = $point->getText();
$color = $point->getColor();
$bar->getBar()->addYTextColor($value, $text, $color);
}
$bar->setLeftLabel($serie->getIndex(),$serie->getLabel());
// Add the Extra Legend Tool
$top = $top - 190;
$extraLegend = new ExtraLegend($this->chart->getChart());
$extraLegend->setSeries($bar->getBar());
$extraLegend->getLegend()->setLeft($left);
$extraLegend->getLegend()->setTop($top);
$extraLegend->getLegend()->setTextStyle(LegendTextStyle::$XVALUE);
}
// Legenda
$this->chart->getLegend()->setLegendStyle(LegendStyle::$VALUES);
}
Re: Extra legend does not show the last mark
Hi Martin,
The code you posted isn't complete. Please, note we need a simple example project we can run as-is to reproduce the problem here.
I'm trying to reproduce it with this:
But I get a legend for each series, all them with the same color, not a legend for each valueIndex:
The code you posted isn't complete. Please, note we need a simple example project we can run as-is to reproduce the problem here.
I'm trying to reproduce it with this:
Code: Select all
$chart = new TChart(700,500);
$chart->getAspect()->setView3D(false);
for ($i=0; $i<4; $i++) {
$bar = new HorizBar($chart->getChart());
$bar->fillSampleValues(4);
$bar->setMultiBar(MultiBars::$STACKED);
$bar->getMarks()->setVisible(false);
}
$chart->doInvalidate();
for ($i=0; $i<4; $i++) {
$extraLegend = new ExtraLegend($chart->getChart());
$extraLegend->setSeries($chart->getSeries($i));
$extraLegend->getLegend()->setLeft(30);
$extraLegend->getLegend()->setTop($chart->getSeries(0)->calcYPos($i));
}
$chart->render();
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Extra legend does not show the last mark
Hi again,
Instead of the above, you could use some dummy series for the legends. In the example below, I create a dummy series, hidden, with the values and colors to show next to each horizontal stacked bar:
Instead of the above, you could use some dummy series for the legends. In the example below, I create a dummy series, hidden, with the values and colors to show next to each horizontal stacked bar:
Code: Select all
$chart->getAspect()->setView3D(false);
for ($i=0; $i<4; $i++) {
$bar = new HorizBar($chart->getChart());
$bar->fillSampleValues(4);
$bar->setMultiBar(MultiBars::$STACKED);
$bar->getMarks()->setVisible(false);
}
$chart->doInvalidate();
$seriesCount = $chart->getSeriesCount();
$maxCount = 0;
for ($i=0; $i<$seriesCount; $i++) {
$maxCount=max($maxCount, $chart->getSeries($i)->getCount());
}
for ($valueIndex=0; $valueIndex<$maxCount; $valueIndex++) {
$extraLegend = new ExtraLegend($chart->getChart());
$dummyBar = new Bar($chart->getChart());
$dummyBar->setActive(false);
for ($seriesIndex=0; $seriesIndex<$seriesCount; $seriesIndex++) {
if ($valueIndex < $chart->getSeries($seriesIndex)->getCount()) {
$dummyBar->addYColor($chart->getSeries($seriesIndex)->getXValues()->getValue($valueIndex), $chart->getSeries($seriesIndex)->getColor());
}
}
$extraLegend->setSeries($dummyBar);
$extraLegend->getLegend()->setLeft(30);
$extraLegend->getLegend()->setTop($chart->getSeries(0)->calcYPos($valueIndex));
}
$chart->render();
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Extra legend does not show the last mark
Problem was : the value was in the legend but its position was to low. When I positioned it higher it did show the complete legend. (I hope you can understand - don't know how to explane )
Re: Extra legend does not show the last mark
Hi Martin,
I think I understand you. The last item in the last legend is drawn below the bottom axis and it's clipped.
I think I understand you. The last item in the last legend is drawn below the bottom axis and it's clipped.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |