XamChart は、ContentControl から派生した Scene を使用しています。この中には、ChartCanvas から派生し、Canvas から派生した ScenePane があります。Scenepane には、ラベルの AxisLabelsPane が含まれています。
ラベルのサイズ変更の課題は、ScenePane、ChartCanvas、および AxisLabelsPane がすべて内部にあり、ラベル用に予約されたサイズがハードコードされていることです。
XamChart のソース コードを取得してソース コードで変更するか、リフレクションを使用して値を変更するという 2 つのオプションがあります。XamChart は Infragistics によって廃止され、これ以上のバグ修正がないため、ソース コードを入手して必要な変更を行うことをお勧めします。
リフレクションを使用したい場合は、次のロジックを ChartRendered イベントに追加すると、チャートの下部にある x 軸ラベルのサイズが 2 倍になりますが、一度移動したラベルの上にチャートがレンダリングされることは妨げられません。
Scene scene = this.AssociatedObject.Scene;
Type sceneType = typeof (Scene);
PropertyInfo scenePaneProperty = sceneType.GetProperty("ScenePane",
BindingFlags.GetProperty | BindingFlags.Instance |
BindingFlags.NonPublic);
Canvas scenePane = scenePaneProperty.GetValue(scene, null) as Canvas;
Type scenePaneType = scenePane.GetType();
Type chartCanvasType = scenePaneType.BaseType;
FieldInfo horizontalAxisLabelsPanel1FieldInfo = scenePaneType.GetField("_labelsHorizontal1",
BindingFlags.Instance | BindingFlags.NonPublic |
BindingFlags.GetField);
Canvas horizontalAxisLabelsPanel1 = horizontalAxisLabelsPanel1FieldInfo.GetValue(scenePane) as Canvas;
PropertyInfo relativePositionProperty = chartCanvasType.GetProperty("RelativePosition",
BindingFlags.NonPublic |
BindingFlags.Instance |
BindingFlags.GetProperty);
relativePositionProperty.SetValue(horizontalAxisLabelsPanel1, new Rect(0,70,100,30),null);