Microsoft Chart control converts \n in file names to newline characters
I am using a Microsoft Chart control (system.windows.forms.datavisualization.charting.chart) in a Windows forms application, vb.net 2008. I use folder paths for the x values in a pie chart. Chart control converts a name like c:\newfolder
into c:[newline]ewfolder
. I tried adding a slash, making it c:\\newfolder
, but this only changes it to c:\[newline]ewfolder
. Is there a workaround for this behavior?
some code:
Chart1.Titles.Clear() : Chart1.Titles.Add("Largest Folders in " & txPath.Text)
Chart1.Series(0).ChartType = DataVisualization.Charting.SeriesChartType.Pie
Chart1.Series(0)("PieLabelStyle") = "Inside"
Chart1.Series(0).YValueType = DataVisualization.Charting.ChartValueType.Double
Chart1.Series(0).XValueType = DataVisualization.Charting.ChartValueType.String
For i = 0 To 9
xVal(i) = Format(value(i) / 1000000, "#,0") & " mb " & fPath(i)
yVal(i) = value(i)
Nex开发者_运维问答t i
Maybe this works
Chart1.Titles.Clear() : Chart1.Titles.Add("Largest Folders in " & txPath.Text.replace("\", "|")
or
For i = 0 To 9
xVal(i) = Format(value(i) / 1000000, "#,0") & " mb " & fPath(i).replace("\", "|")
yVal(i) = value(i)
Next i
Maybe replacing with "/" will even integration with Windows Explorer via copy paste possible.
精彩评论