sdbinstr
(sdbinstr)
March 7, 2017, 6:13am
1
i was made a Sample project with fnc chart.(trial)
but i found a one issue about XValueText when my chart has
only 1 count of X value.
If fncchart(bar chart series) x value count is 1, the XValueText is
unconditionally marked as 0.
how can i handled a XValueText when x values has one count?
Hi,
Can you provide some sample code that demonstrates this so we can investigate exactly what is going wrong?
sdbinstr
(sdbinstr)
March 7, 2017, 9:01am
3
i used same function at Month/Year period chart.
monthly chart's XValueText is good.
when year chart's x value count is 1, XValueText shows '0'
but my functions uses AddPoint(Xvalue, XValueText).
below the sample code
LYmax := LDayList.result[0].Cnt * 1.1;
for I := 0 to LDayList.Count - 1 do
begin
ChartStat.Series[idx].AddPoint(LDayList.result.Cnt, DateToStr(LDayList.result.Day) + LPeriodStr);
end;
<Year Chart>
<Month Chart>
Please provide additional information such as sample code. It's unclear exactly what happens without the full source code.
sdbinstr
(sdbinstr)
March 7, 2017, 9:15am
5
okay, thank you Mr.Scheldeman.
it's my full function code.
TYearStat = class(TObject)
Cnt: Integer;
Year: Integer;
end;
TResultList<T> = class
result: array of T;
private
function GetCount: Integer;
public
property Count: Integer read GetCount;
end;
procedure TMainForm.InitYearChartData(Sender: TObject; idx: Integer);
var
I: Integer;
LPeriodStr: string;
LYearList: TResultList<TYearStat>;
begin
ChartStat.BeginUpdate;
ChartStat.Series[idx].Points.Clear;
LPeriodStr := 'Year';
LYearList := Sender as TResultList<TYearStat>;
ChartStat.Series[idx].MaxX := LYearList.Count;
if LYearLIst.COunt = 1 then
ChartStat.Series[idx].AddPoint(0, (LYearList.result[0].Year - 1).ToString + LPeriodStr);
for I := 0 to LYearList.Count - 1 do
begin
if idx = 0 then
ChartStat.Series[idx].MaxY := LYearList.result.Cnt * 1.1;
ChartStat.Series[idx].AddPoint(LYearList.result.Cnt, (LYearList.result.Year).ToString + LPeriodStr);
end;
ChartStat.Series[idx].MaxY := ChartStat.Series[0].MaxY;
ChartStat.EndUpdate;
end;
sdbinstr
(sdbinstr)
March 8, 2017, 2:05am
7
thank you, i'm sorry do not have enough explanation. I will send email.