我正在使用MPAndroidChart库中的IAxisValueFormatter
。
我正在添加x值作为时间戳,我使用LineChart
转换为日期这里的问题是一切正常,但只显示最后一个日期的一个数据,图表结束。有没有办法显示SELECT
(CASE
WHEN T.Id is null and lc.Code = 1 THEN 1
WHEN T.Id is null and lc.Code = 2 THEN 4
WHEN T.Id is null and lc.Code = 3 THEN 5
ELSE T.Id
END) as Id,
lc.Code, lc.Id as LanguageId, T.Value from
(SELECT x.Id, y.Code from (SELECT Id FROM Languages) x cross join (SELECT DISTINCT(Code) as Code FROM Translations) y) as lc
left outer join Translations T ON lc.Id = T.LanguageId and lc.Code = T.Code
order by Id, Code, LanguageId
答案 0 :(得分:0)
建议您尝试使用axis.setAxisMinimum(0.0f); axis.setAxisMaximum(??); axis.setLabelCount(??);
ArrayList<String> xVals = setXAxisValues(extraFromDate,extraToDate);
XAxis axis = mLineChart.getXAxis();
axis.setAxisMinimum(0.0f);
axis.setAxisMaximum(((float) mTotalNumberOfDay));
axis.setValueFormatter(new IndexAxisValueFormatter(xVals));
axis.setLabelCount(xVals.size());
axis.setGranularity(1f);
axis.setGranularityEnabled(true);
axis.setCenterAxisLabels(true);
axis.setAxisLineWidth(2f);
axis.setPosition(XAxis.XAxisPosition.BOTTOM);
axis.setDrawGridLines(false);
我在这里发布了我的工作代码 click here for full code(对不起,我的代码会有点乱,这是我第一个开发的Android应用程序)