Hi all,
I have created a scatter chart in a composite chart and have added a series of data to it.
I am wondering whether there is any function to define a text against every point in the graph (similar to excel).
Thx in advance
You can try something like:
ScatterChartAppearance scatterApp = chartApp.ChartTypeAppearance as ScatterChartAppearance;
textApp.Row = -2;
textApp.Column = -2;
scatterApp.ChartText.Add(textApp);
More about formatting of the labels you can find here:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/Chart_Label_Formatting.html
Hi Tedor,
Thanks for your reply..
I did that and its working fine....but i can ploy only either the X axis or Y Axis value....but i need the label column..
I am able to do that ONLY as a tooltip as below....
this.ultraChart1.Tooltips.Format = TooltipStyle.LabelPlusDataValue;
but i need to display it on the screen not as a tooltip...
when i tried the below one it displays as "ITEM_LABEL" on the screen...
CT1.ItemFormatString = "<ITEM_LABEL>";
Help me to solve my issue.... Thanks.....
Hi Teodor,
I am using the version 7.2.20072.61.
I have the same issue, as i have to show custom labels on a composite chart. I tried using the solution you suggested. But the toString method in the just does not get called.
The chart is diplayed as below. Please help me out. I am trying to use a scatter chart and am trying to label the points in the scatter chart.
I have used the following code.
axisXScatter =
new AxisItem
();
axisXScatter.OrientationType =
AxisNumber
.X2_Axis;
axisXScatter.Labels.Orientation =
TextOrientation
.VerticalLeftFacing;
axisXScatter.Labels.Font =
new Font("Verdana"
, 8);
axisXScatter.RangeMin = 0;
axisXScatter.TickmarkInterval = 1;
axisXScatter.TickmarkStyle =
AxisTickStyle
.DataInterval;
axisXScatter.Margin.Far.Value = 5;
axisXScatter.Margin.Far.MarginType =
LocationType
.Pixels;
axisXScatter.Labels.Visible =
true
;
axisXScatter.Visible =
myChartArea.Axes.Add(axisXScatter);
ChartLayerAppearance legendScatterLayer = new ChartLayerAppearance
legendScatterLayer.ChartType =
ChartType
.ScatterChart;
legendScatterLayer.ChartArea = myChartArea;
legendScatterLayer.AxisY = axisY;
legendScatterLayer.AxisX = axisXScatter;
legendScatterLayer.AxisX.Visible =
false
ScatterChartAppearance sca = new ScatterChartAppearance
sca.NullHandling =
NullHandling
.Zero;
sca.Icon =
SymbolIcon
.Circle;
sca.IconSize =
SymbolIconSize
.Small;
sca.LineAppearance.Thickness = 1;
sca.ConnectWithLines =
this.resultChart1.CompositeChart.ChartLayers.Add(legendScatterLayer);
//Add Chart Layer
textApp;
textApp =
new ChartTextAppearance
textApp.Visible =
textApp.ItemFormatString =
"<MY_VALUE>"
sca.ChartText.Add(textApp);
Hashtable labelHashTable = new Hashtable
string[] arr = { "^"
};
List<string> stringList = new List<string
>();
foreach (string strKey in
myDictionary.Keys)
{
if (!stringList.Contains(((strKey.Split(arr, StringSplitOptions
.None))[0]).Trim()))
stringList.Add((strKey.Split(arr,
StringSplitOptions
.None)[0]).Trim());
}
//labelHashTable.Add((strKey.Split(arr, StringSplitOptions.None)[1]) + "^" + (strKey.Split(arr, StringSplitOptions.None)[0]), new MyLabelRenderer(this.resultChart1));
legendScatterLayer.ChartTypeAppearance = sca;
xlength = xstdwidth / noOfMonths;
double
xCount = 0;
XYSeries xySeries = new XYSeries
xySeries.Visible =
foreach (string yearMonthString in
stringList)
if((strKey.Split(arr, StringSplitOptions
.None)[0]).Trim() == yearMonthString)
xySeries.Points.Add(
new XYDataPoint(xCount,myDictionary[strKey],yearMonthString,false
));
xySeries.PEs.Add(
new PaintElement(Color
.Silver));
xCount += xlength;
this.resultChart1.Tooltips.Display = TooltipDisplay
.MouseMove;
this
.resultChart1.Series.Add(xySeries);
legendScatterLayer.Series.Add(xySeries);
labelHashTable.Add((strKey.Split(arr,
StringSplitOptions.None)[1]) + "^" + (strKey.Split(arr, StringSplitOptions.None)[0]), new MyLabelRenderer(this
.resultChart1));
.resultChart1.LabelHash = labelHashTable;
/////////////////////////////////////////////////////////////////////////////////////
public class MyLabelRenderer : IRenderLabel
xySeries;
ultraChart)
context)
];
.xySeries.Points[row];
xyPoint.Label;}}
Please help me out. I am desperate to get this done now.
Apologies. The code had too many blank spaces.
Also I meant the ToString() method in MyLabelRenderer just would be called.
Please help me out. I am really desperate to get this done.
Hi,
You need to specify the label hash table in this way:
Hashtable labelHashTable = new Hashtable();
labelHashTable.Add("MY_VALUE", new MyLabelRenderer(this.ultraChart1));
this.ultraChart1.LabelHash = labelHashTable;
Still the same issue.
Basically I want to display the items in the legend with their names. Say in the above chart, if it is green then i want to display COB. So i have used the Scatter chart and want to label the points with certain names. I have used the following code.
foreach (string strKey in myDictionary.Keys) {
StringSplitOptions.None)[1]) + "^" + (strKey.Split(arr, StringSplitOptions.None)[0]), new MyLabelRenderer(this.resultChart1));}
this.resultChart1.LabelHash = labelHashTable;
I am creating a string in the key value because my keys will be repeated. So i am planning on extracting the string i want to diplay in the toString method. But the tostring method does not get called.
Please help.
In the label hash table you need to add string/ILabelRenderer pairs. The “string” key is used from:
textApp.ItemFormatString ="<MY_VALUE>";
You can’t use this with the way you are trying to.
Can you send me a zipped sample that I can compile so I can find your issue?