[vtkusers] vtkBarChartActor and fonts
Jeff Baumes
jeff.baumes at kitware.com
Wed Apr 8 16:41:31 EDT 2009
You can name bars in a bar chart by adding another column to the table
that the chart uses. This can be a string array with ranges (like
"0-4", "5-9"), or a numeric array (perhaps containing the bin
centers). Make sure you name the arrays in the vtkTable, then after
you add the table to the view, retrieve the representation with
GetRepresentation(), downcast with
vtkQtChartTableRepresentation::SafeDownCast(rep), and call
tablerep->SetKeyColumn(name). This will make the chart use the
specified column as the x axis values.
Note: If you are using VTK CVS head, a few class names will soon
change slightly:
1. vtkQtChartViewBase will be called vtkQtChartView.
2. vtkQtChartTableRepresentation will be called vtkQtChartRepresentation.
You can always check GUISupport/Qt/Testing/Cxx/TestVtkBarChartView.cxx
for the most up-to-date way to make a bar chart if your code suddenly
breaks.
Jeff
On Wed, Apr 8, 2009 at 12:51 PM, Aytekin Vargun <varguna at gmail.com> wrote:
> Thanks a lot.
> This really works much better than vtkBarChartActor. Is there a way to
> change bar labels? If there are 5 bins, by default the bar names are numbers
> from 0 to 4. I want to replace them with some intervals like "0 - 4", "5-9"
> .. etc. Is this possible?
>
> What I need is something like (with vtkBarChartActor:)
>
> actor->SetBarLabel(i, barName[i]); where barName contains names of bars on
> x-axis
>
> Thanks a lot.
> Aytekin
>
> On Thu, Mar 26, 2009 at 9:46 AM, Jeff Baumes <jeff.baumes at kitware.com>
> wrote:
>>
>> If you have access to Qt, GUISupport\Qt\vtkQtBarChartView may be a
>> better choice. It can display the contents of a vtkTable.
>>
>> Jeff
>>
>> On Wed, Mar 25, 2009 at 12:42 PM, Aytekin Vargun <varguna at gmail.com>
>> wrote:
>> >
>> > Hello,
>> > I am using vtkBarChartActor to display a histogram in one of my
>> > applications. I have a couple of questions about this:
>> > - The font on the y-axis of the barchart is too large.
>> > - The title of the barchart is almost unreadable since the font is too
>> > small.
>> > - Similarly the intervals shown on x-axis are printed with with small
>> > fonts.
>> > - Right next to the bar chart, the bins on the x-axis are displayed
>> > again. I
>> > want to display frequencies instead there. Is this possible?
>> >
>> > In general, How can I play with fonts? Should I use vtkTextProperty or
>> > any
>> > other suggestions?
>> > Thanks a lot.
>> > Aytekin
>> >
>> > --
>> > My web page: http://www.cs.rpi.edu/~vargua
>> >
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the VTK FAQ at:
>> > http://www.vtk.org/Wiki/VTK_FAQ
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.vtk.org/mailman/listinfo/vtkusers
>> >
>> >
>>
>>
>>
>> --
>> Jeff Baumes, Ph.D.
>> R&D Engineer, Kitware Inc.
>> (518) 371-3971 x132
>> jeff.baumes at kitware.com
>
>
>
> --
> My web page: http://www.cs.rpi.edu/~vargua
>
More information about the vtkusers
mailing list