Samples
for (int j = 0; j < 96; j++)//24*60/15
{
var dt = _endDateTime.AddMinutes(-j * 15).AddMilliseconds(ran.Next(1000));
var ts = (dt.Ticks - _startDateTime.Ticks) * 100L + ran.Next(1000000);
var value = Math.Round((ran.NextDouble() + ran.NextDouble() + 0.0313) * 100, 2);
list.Add(PointData.Measurement("tag_value")
.Tag($"tag_id_{dt.ToString("yyyy-MM")}", t)
.Field("val", value)
.Timestamp(ts, WritePrecision.Ns));//注意时间戳,有肯能数据丢失
}
_helper.Write(write =>
{//批量插入
write.WritePoints(list, "po", "se");
});
Source Code
Code