I'm working at bit with graphics and I need to get the labeling for the axis on my graph to be a single vertical line of text when my chart is rendered. I don't care if some text is cut off, but I need it to truncate gracefully.
I'm using the WebChart dll provided by Carlos Ag and am passing a System.Drawing.StringFormat object to the chart.
objChartText = New WebChart.ChartText
objChartText.Font = New Font("Verdana", 8, FontStyle.Regular, GraphicsUnit.Point)
Dim objStringFormat As StringFormat = New StringFormat(StringFormatFlags.DirectionVertical)
objStringFormat.LineAlignment = StringAlignment.Center
objStringFormat.Alignment = StringAlignment.Center
objStringFormat.Trimming = StringTrimming.Word
objChartText.StringFormat = objStringFormat
"StringformatFlags.DirectionVerticle" is an enum that determines a position. I'm wondering if there is a different known non-enum value that I can pass that will give me the desired result. None of the defined enums give me what I want. I've tried simply adding the enums I want 2 (DirectionVertical) and 4096 (nowrap) but that leaves single characters with wide spacing below the graph.
Any suggestions?
The problem here is actually the trimming and alignment, not the enum.
The enum can be added to combine effects. In this case the right value is 4098 so the instantiation should read
Dim objStringFormat As StringFormat = New StringFormat(4098)
and the trimming or alignment should be changed. My solution was to change the trimming to
objStringFormat.Trimming = StringTrimming.Character
This solved my problem and allowed me to create a pretty graph.