chart = (Object) XtVaCreateWidget("BarPlot",
(WidgetClass)xintChartObjectClass, edit,
XmNgeometry, &chart_geometry,
XmNchartType, XintCHART_TYPE_BAR,
XmNchartTitle, "Yearly Sales",
XmNshowLegend, True,
NULL);
plot = XintChartGetComponent(chart, XintCHART_COMPONENT_PLOT);
XtVaSetValues((Widget) plot,
XmNbarOrientation, XintHORIZONTAL,
XmNbarStyle, XintSTACKED,
XmNclusterWidth, 100,
NULL);
Chart object resources and chart component resources are set in the same manner as are X resources, using instance names and/or class names. Drop the XmN prefix from the resource names. To set a value to an INT constant, drop the Xint prefix from the constant and convert the remaining term to lower case. For example:
XintPLACEMENT_LEFT becomes placement_left
Several of the hardcoded resources in the previous section could be defined by resource file entries, as shown by the following example.
*XintChart.chartType: chart_type_bar
*XintChart.chartTitle: Yearly Sales
Chart component resources may be identified by their class name in order to specify new values in the resource file. However, this makes changes in all occurrences of the class. The following table lists the object name and the class name for end-user specifiable ChartObject components.
| Object Name | Class Name |
|---|---|
| chart_title | XintText |
| chart_footer | XintText |
| chart_legend | XintLegend |
| plot_haxis (created for 2D plots only) | XintAxisObject |
| plot_vaxis (created for 2D plots only) | XintAxisObject |
To change resources for all TextObjects use the class name:
*XintText.color: cyan
*XintText.fontFamily: helvetica
To change only the chart title's resources use the object name:
*chart_title.color: red
*chart_title.fontFamily: helvetica
Some of the resources which are set when chart creates its components are listed in the following table. These cannot be changed by the end-user in a resource file.
| Object Name | Resource Name |
|---|---|
| chart_title | XmNfontSize XmNfontWeight XmNtextString |
| chart_footer | XmNfontSize XmNfontWeight XmNtextString |
| plot_haxis | XmNtickPlacement |
| plot_vaxis | XmNtickPlacement |
The chart resources, XmNchartTitle and XmNchartFooter, can be used to set the title and footer text strings.


The resource file listed below contains all of the resource settings that were used to change the display from the one shown in Figure 16 to the one in Figure 17.
! resource file example
!
! Chart Class
!
*chartTitle: Bar Chart
*chartFooter: Demonstrates creating \n two footer lines
*fillColor: gray85
!
! Text Class
!
*chart_title.color: red
*chart_title.fontFamily: helvetica
*chart_title.dashList: 3,,1
*chart_title.fillColor: white
*chart_title.fillStyle: fill_solid
*chart_title.roundEdge: True
*chart_footer.color: black
*chart_footer.fontFamily: times
!
! Legend Class
!
*.showLegend: True
*chart_legend.columns: 1
*chart_legend.LegendTitle: Cities
*chart_legend.font: *Helvetica*-120-*
*chart_legend.highlightMode: highlight_none
*chart_legend.marginHeight: 10
*chart_legend.marginWidth: 10
*chart_legend.color: steel blue
*chart_legend.fillColor: white
*chart_legend.fillStyle: fill_solid
*chart_legend.lineStyle: shadow_out
*chart_legend.lineThickness: 8
!
! AxisObject
!
*XintAxisObject.labelFont: *-Helvetica*-120-*
*plot_haxis.label: Texas Cities
*plot_haxis.color: black
*plot_vaxis.label: Housing Starts (000)
*plot_vaxis.color: black
!
! BarLine Class
!
*XintBarLine.drawShadow: True
*XintBarLine.inclination: 20
*XintBarLine.rotation: 10