why my dataset.data's shape is different with each image? - dataset

I download the cifar10 dataset with torchvision
for idx,(img,target) in enumerate(trainloader):
print(trainloader.dataset.data.shape)
print(img.shape)
img = img.squeeze()
img = torch.tensor(img)
img=img.squeeze()
print(img.shape)
img = (img).permute(1, 2, 0)
plt.imshow(img)
plt.show()
if idx==0:break
But the print result is strange
(50000, 32, 32, 3)
torch.Size([1, 3, 224, 224]) torch.Size([3, 224,
224])
each image is size with (3,224,224) but the dataset.data's shape is (32,32,3)<br/>
I want to make the dataset's shape with (500000,224,224,3)
def load_data_cifar10(batch_size=128,test=False):
if not test:
train_dset = torchvision.datasets.CIFAR10(root='/mnt/3CE35B99003D727B/input/pytorch/data', train=True,
download=True, transform=transform)
else:
train_dset = torchvision.datasets.CIFAR10(root='/mnt/3CE35B99003D727B/input/pytorch/data', train=False,
download=True, transform=transform)
train_loader = torch.utils.data.DataLoader(train_dset, batch_size=batch_size, shuffle=False)
transform = transforms.Compose([
transforms.Resize(224),
transforms.ToTensor(),
])

Related

Babylon js texture issue when used with reactjs

I'm implementing 3D demo application using Babylonjs library for 3D Demo.I'm importing 3D model from S3 and adding texture image on top of material in Reactjs.
But when i add texture image on top of material, rest of area on 3D model gets black color and i want get rid of it. Code works fine in Babylon playground but fails in React app.
Here is the source code
var mat = new BABYLON.CustomMaterial("mat", scene);
mat.diffuseTexture = new BABYLON.Texture(textureImage, scene, false, false);
materialedMeshes.forEach(mesh => mesh.material = mat);
mat.emissiveColor = new BABYLON.Color3(1, 1, 1);
// mat.diffuseColor = new BABYLON.Color3(1, 0, 1);
// mat.specularColor = new BABYLON.Color3(0.5, 0.6, 0.87);
// mat.emissiveColor = new BABYLON.Color3(1, 1, 1);
// mat.ambientColor = new BABYLON.Color3(0.23, 0.98, 0.53);
mat.diffuseTexture.uOffset = -0.1000;
mat.diffuseTexture.vOffset = -1.1800;
mat.diffuseTexture.uScale = 1.2200;
mat.diffuseTexture.vScale = 2.2200;
mat.diffuseTexture.uAng = Math.PI;
mat.diffuseTexture.wrapU = BABYLON.Constants.TEXTURE_CLAMP_ADDRESSMODE;
mat.diffuseTexture.wrapV = BABYLON.Constants.TEXTURE_CLAMP_ADDRESSMODE;
mat.Fragment_Custom_Alpha(`
if (baseColor.r == 0. && baseColor.g == 0. && baseColor.b == 0.) {
baseColor.rgb = vec3(0.85, 0.85, 0.85);
}
baseColor.rgb = mix(vec3(0.85, 0.85, 0.85), baseColor.rgb, baseColor.a);
`)

Fixing Plotting of Initial Balance Indicator in AmiBroker AFL

I am using the following AFL code for "Initial Balance with Range Extension" in AmiBroker -
_SECTION_BEGIN("Initial Balance with Range Extensions");
P11 = Param("IB Start Time",091500, 0 , 235959, 1 ) ;
P12 = Param("IB END Time",101500, 0 , 235959, 1 ) ;
START = (TimeNum()>= P11);
END = (TimeNum()<= P12);
ZONE = START AND END;
ST = (TimeNum()>= P12);
NewTime = ZONE!= Ref(ZONE, -1);
highestoftheday = HighestSince(NewTime,H,1);
Lowestoftheday = LowestSince(NewTime,L,1);
IBHigh = ValueWhen(ZONE,highestoftheday,1);
IBLow = ValueWhen(ZONE,lowestoftheday,1);
ORBClose = ValueWhen(zone,C,1);
IBrange = IBHigh - IBLow; // First Hour Range
IBM = IBLow+IBrange/2;
IB1xh = IBHigh+IBrange ; // Target 1 for range extension upside
IB2xh = IBHigh+2*IBrange ;
IB3xh = IBHigh+3*IBrange ;
IB1xl = IBLow-IBrange ;
IB2xl = IBLow-2*IBrange ; // target 1 for range extension downside
IB3xl = IBLow-3*IBrange ;
PlotGrid(LastValue(IBHigh, True), colorPlum, pattern=10, width = 2, label = True);
PlotGrid(LastValue(IBLow, True), colorPlum, pattern=10, width = 2, label = True);
PlotGrid(LastValue(IBM, True), colorBrown, pattern=10, width = 2, label = True);
PlotGrid(LastValue(IB1xh, True), colorGreen, pattern=10, width = 2, label = True);
PlotGrid(LastValue(IB2xh, True), colorGreen, pattern=10, width = 2, label = True);
PlotGrid(LastValue(IB3xh, True), colorGreen, pattern=10, width = 2, label = True);
PlotGrid(LastValue(IB1xl, True), colorRed, pattern=10, width = 2, label = True);
PlotGrid(LastValue(IB2xl, True), colorRed, pattern=10, width = 2, label = True);
PlotGrid(LastValue(IB3xl, True), colorRed, pattern=10, width = 2, label = True);
_SECTION_END();
This code is plotting continuous horizontal lines. But I need disjointed horizontal lines for individual sessions. How can I get that? Please help me to fix this issue. Thanks for your time and effort. Regards.

GL_Invalid_Operation in OpenGL applications

I am currently wiring an OpenGL application and am getting GL_INVALID_OPERATION. The whole GL is scattered among several files and its hard to create an example out of it, but I have created an OpenGL trace using apitrace. This is one chunk that created the error:
glMatrixMode(mode = GL_PROJECTION)
glLoadIdentity()
glViewport(x = 0, y = 0, width = 1190, height = 746)
glOrtho(left = 0, right = 1190, bottom = 0, top = 746, zNear = 0, zFar = 128)
glBegin(mode = GL_QUADS)
glColor4f(red = 0.5, green = 0.5, blue = 0.5, alpha = 1)
glVertex3f(x = 1190, y = 746, z = 0)
glColor4f(red = 0.5, green = 0.5, blue = 0.5, alpha = 1)
glVertex3f(x = 0, y = 746, z = 0)
glColor4f(red = 0.5, green = 0.5, blue = 0.5, alpha = 1)
glVertex3f(x = 0, y = 100, z = 0)
glColor4f(red = 0.5, green = 0.5, blue = 0.5, alpha = 1)
glVertex3f(x = 1190, y = 100, z = 0)
glEnd()
glGetError() = GL_INVALID_OPERATION
Has someone any idea on this?
GL_QUADS is deprecated since version 3 and removed since version 3.1.
https://www.khronos.org/opengl/wiki/Primitive#Quads

Import many files .txt in SAS

I built a code to import multiple data simultaneously into SAS, but I want to improve it does anyone have any suggestions?
filename indata pipe 'dir E:\Desafio_SAS\Dados /B';
data file_list;
length arquivos$20.;
infile indata truncover ;
input arquivos $20.;
call symput('num_files',_n_);
arquivos=compress(arquivos,',.txt');
run;
CRIANDO UMA MACRO POR PROC SQL PARA GUARDAR O NOME DOS ARQUIVOS
proc sql;
select arquivos into :lista separated by ' ' from file_list;
quit;
%let &lista;
%macro importar(arquivo=);
filename data "E:\Desafio_SAS\Dados\&arquivo..txt";
data &arquivo;
infile data dlm=" " missover dsd firstobs=2;
input v0 (v1 - v8) ($);
format v0 F16.;
run;
%mend importar;
%macro fileout;
%do i=1 %to &num_files;
%importar(arquivo=df&i);
data df&i;
set var_names df&i;
run;
%end;
%mend fileout;
%fileout;
%macro excluiv0;
%do i=1 %to &num_files;
data _null_;
data df&i(drop = v0);
set df&i;
run;
%end;
run;
%mend excluiv0;
%excluiv0;
It's just part of the code.
You can use a wildcard in the infile file-specification. As long as all the files meeting the wildcard are the same layout, you can use a single input to read all the files.
Example
* create three text files having same fields;
data _null_;
file '%temp%\1.txt';
put '1 2 3 abc';
put '3 4 5 def';
file '%temp%\2.txt';
put '6 7 8 ghi';
put '9 10 11 jkl';
file '%temp%\3.txt';
put '12 13 14 xyz';
put '15 16 17 tuv';
run;
* read all three using wildcard in infile. Save name of file whence
* data cometh frometh;
data want;
length _filename_ $250;
infile '%temp%\?.txt' filename=_filename_;
length source $250;
length a b c 8 s $20;
source = _filename_;
input a b c s;
run;
Wildcards are
?, 0 or 1 of any character
*, any number of any character
t1 <- ttheme_default(core=list(
fg_params=list(fontface=c("bold.italic")),
bg_params = list(fill=c("green", "grey90","blue","red"))))
grid.arrange(g1,
tableGrob(iris[1:5, 1:4], theme = t1,, rows=NULL),
g1, g1, nrow = 2)
---
title: "Column Orientation"
output: flexdashboard::flex_dashboard
---
```{r setup, include=FALSE}
library(ggplot2);library(knitr);library(kableExtra)
library(flexdashboard);library(gridExtra);library(grid)
```
<style>
.colored {
background-color: #002080;}
</style>
Column{data-width=200}
-------------------------------------
### Chart 1{.colored}
```{r}
gauge(10, min = 0, max = 100, sectors = gaugeSectors(colors = "#002080"))
gauge(50, min = 0, max = 100, sectors = gaugeSectors(colors = "#002080"))
gauge(20, min = 0, max = 100, sectors = gaugeSectors(colors = "#002080"))
gauge(15, min = 0, max = 100, sectors = gaugeSectors(colors = "#002080"))
gauge(5 , min = 0, max = 100, sectors = gaugeSectors(colors = "#002080"))
```
Column
-------------------------------------
### Chart 2
```{r, include=FALSE}
tt1 <- ttheme_default()
tt2 <- ttheme_minimal()
tt3 <- ttheme_minimal(
core=list(bg_params = list(fill = blues9[1:4], col=NA),
fg_params=list(fontface=3)),
colhead=list(fg_params=list(col="navyblue", fontface=4L)),
rowhead=list(fg_params=list(col="orange", fontface=3L)))
tab <- grid.arrange(tableGrob(iris[c(1:4,1:2), c(1:3,1:2)], theme=tt3), nrow=1)
graf <- ggplot(data=mtcars, aes(x=drat, y=disp, group=vs)) +
geom_line() + ylab("") +
geom_point()
gg.gauge <- function(pos,breaks=c(0,10,25,100)) {
get.poly <- function(a,b,r1=0.5,r2=1.0) {
th.start <- pi*(1-a/100)
th.end <- pi*(1-b/100)
th <- seq(th.start,th.end,length=1000)
x <- c(r1*cos(th),rev(r2*cos(th)))
y <- c(r1*sin(th),rev(r2*sin(th)))
return(data.frame(x,y))
}
ggplot()+
geom_polygon(data=get.poly(breaks[1],breaks[2]),aes(x,y),fill="forestgreen", colour = "white", size = 1.2, alpha = 0.7) +
geom_polygon(data=get.poly(breaks[2],breaks[3]),aes(x,y),fill="gold", colour = "white", size = 1.2, alpha = 0.7) +
geom_polygon(data=get.poly(breaks[3],breaks[4]),aes(x,y),fill="red", colour = "white", size = 1.2, alpha = 0.7) +
geom_polygon(data=get.poly(pos-1,pos+1,0.2),aes(x,y), colour = "white")+
annotate("text",x=0,y=0,label=pos,vjust=0,size=8,fontface="bold")+
coord_fixed()+
theme_bw()+
theme(axis.text=element_blank(),
axis.title=element_blank(),
axis.ticks=element_blank(),
panel.grid=element_blank(),
panel.border=element_blank())
}
gg1 <- gg.gauge(2,breaks=c(0,10,25,100))
gg2 <- gg.gauge(5,breaks=c(0,10,25,100))
gg3 <- gg.gauge(7,breaks=c(0,10,25,100))
```
```{r, fig.width=9.5, fig.height=7}
for (i in 1:5){
title1=textGrob("Test title TESTE", gp=gpar(fontface="bold", fontsize = 15))
lay <- rbind(c(3,3,4,4,5,5),
c(1,1,1,1,1,1),
c(1,1,1,1,1,1),
c(2,2,2,2,2,2),
c(2,2,2,2,2,2))
grid.arrange(graf, tab, gg1, gg2, gg3, top=title1,
layout_matrix= lay)
grid.rect(width = 1, height = 1, gp = gpar(lwd = 2, col = "black", fill = NA))
cat("\n")
}
```
---
title: "BRADESCO"
output:
flexdashboard::flex_dashboard:
orientation: rows
---
```{r setup, include=FALSE}
library(ggplot2);library(knitr);library(kableExtra)
library(flexdashboard);
library(gridExtra);library(grid)
```
Geral {data-icon="fa-signal"}
=====================================
### Chat 1
```{r}
p1 <- qplot(mpg, wt, data = mtcars, colour = cyl)
p2 <- qplot(mpg, data = mtcars)
p3 <- qplot(mpg, data = mtcars, geom = "dotplot")
lay <- rbind(c(1,1,1,2,2,2),
c(3,3,3,3,3,3))
grid.arrange(p2, p3, p1, nrow = 2, layout_matrix= lay)
```
### Table 1
```{r}
kable(mtcars[1:10, c(1:6,1:4)], caption = "Group Rows") %>%
kable_styling("striped", full_width = F) %>%
group_rows("Group 1", 4, 7) %>%
group_rows("Group 2", 8, 10)
```
Por segmento {data-icon="fa-signal"}
=====================================
<style>
.colored {
background-color: #002080;}
</style>
Row{data-height=200}
-------------------------------------
### Chart 1{.colored}
```{r, fig.width=55}
dat = data.frame(count=rep(c(10, 60, 30),10), category=rep(c("A", "B", "C"),10), fator=c(1,2,3,4,5))
# Add addition columns, needed for drawing with geom_rect.
dat$fraction = dat$count / sum(dat$count)
dat = dat[order(dat$fraction), ]
dat$ymax = cumsum(dat$fraction)
dat$ymin = c(0, head(dat$ymax, n=-1))
p <- ggplot(dat, aes(x=2, y=fraction, fill=category))+
geom_bar(stat="identity", colour = "white", size = 2) +
xlim(0, 2.5) +
scale_fill_manual(values=c("#002080", "#002080", "white")) +
coord_polar(theta = "y")+
labs(x=NULL, y=NULL)+ guides(fill=FALSE) +
ylab("fsfagafs") + facet_wrap(~ fator,nrow = 1) +
annotate("text", x = 0, y = 0, label = "WW", size = 20, colour = "white") +
theme(
plot.margin = margin(-1.1, 3.6, -1.1, 3.6, "cm"),
panel.spacing = unit(30, "lines"),
axis.ticks=element_blank(),
axis.text=element_blank(),
axis.title=element_blank(),
panel.grid=element_blank(),
plot.background = element_rect(fill = "#002080", colour="#002080"),
panel.background = element_rect(fill = "#002080", colour="#002080"),
strip.background = element_blank(),
strip.text.x = element_blank())
p
```
Row
-------------------------------------
### Chart 2 {data-wight=900}
```{r, include=FALSE}
tt1 <- ttheme_default()
tt2 <- ttheme_minimal()
tt3 <- ttheme_minimal(
core=list(bg_params = list(fill = blues9[1:4], col=NA),
fg_params=list(fontface=3)),
colhead=list(fg_params=list(col="navyblue", fontface=4L)),
rowhead=list(fg_params=list(col="orange", fontface=3L)))
tab <- grid.arrange(tableGrob(iris[c(1:4,1:2), c(1:3,1:2)], theme=tt3), nrow=1)
graf <- ggplot(data=mtcars, aes(x=drat, y=disp, group=vs)) +
geom_line() + ylab("") +
geom_point()
gg.gauge <- function(pos,breaks=c(0,10,25,100)) {
get.poly <- function(a,b,r1=0.5,r2=1.0) {
th.start <- pi*(1-a/100)
th.end <- pi*(1-b/100)
th <- seq(th.start,th.end,length=1000)
x <- c(r1*cos(th),rev(r2*cos(th)))
y <- c(r1*sin(th),rev(r2*sin(th)))
return(data.frame(x,y))
}
ggplot()+
geom_polygon(data=get.poly(breaks[1],breaks[2]),aes(x,y),fill="forestgreen", colour = "white", size = 1.2, alpha = 0.7) +
geom_polygon(data=get.poly(breaks[2],breaks[3]),aes(x,y),fill="gold", colour = "white", size = 1.2, alpha = 0.7) +
geom_polygon(data=get.poly(breaks[3],breaks[4]),aes(x,y),fill="red", colour = "white", size = 1.2, alpha = 0.7) +
geom_polygon(data=get.poly(pos-1,pos+1,0.2),aes(x,y), colour = "white")+
annotate("text",x=0,y=0,label=pos,vjust=0,size=8,fontface="bold")+
coord_fixed()+
theme_bw()+
theme(axis.text=element_blank(),
axis.title=element_blank(),
axis.ticks=element_blank(),
panel.grid=element_blank(),
panel.border=element_blank())
}
gg1 <- gg.gauge(2,breaks=c(0,10,25,100))
gg2 <- gg.gauge(5,breaks=c(0,10,25,100))
gg3 <- gg.gauge(7,breaks=c(0,10,25,100))
```
```{r, fig.width=7.2, fig.height=7}
for (i in 1:5){
title1=textGrob("Test title TESTE", gp=gpar(fontface="bold", fontsize = 15))
lay <- rbind(c(3,3,4,4,5,5),
c(1,1,1,1,1,1),
c(1,1,1,1,1,1),
c(2,2,2,2,2,2),
c(2,2,2,2,2,2))
grid.arrange(graf, tab, gg1, gg2, gg3, top=title1,
layout_matrix= lay)
grid.rect(width = 1, height = 1, gp = gpar(lwd = 2, col = "black", fill = NA))
cat("\n")
}
```
### Chart 2
```{r}
mydata = data.frame(x1 = c(1,2,3),
x2 = c(9,8,7),
label = c("description a",
"description b",
"description c"))
ht = 5
wd1 = 5
wd2 = 12
gap = 0.1
nc = ncol(mydata)
nr = nrow(mydata)
x = rep(c(seq(0,(nc-2)*(wd1+gap), wd1+gap), (nc-2)*(wd1+gap) + gap + 0.5*(wd2+wd1)), nr)
y = rep(seq(0,(nr-1)*(ht+gap), ht+gap), nc) %>% sort()
h = rep(ht, nr * nc)
w = rep(c(rep(wd1, nc-1), wd2), nr)
info = as.vector(t(as.matrix(mydata[nr:1,])))
df = data.frame(x = x, y = y, h = h, w = w, info = info)
ggplot(df, aes(x, y, height = h, width = w, label = info)) +
geom_tile() +
geom_text(color = "white", fontface = "bold") +
coord_fixed() +
scale_fill_brewer(type = "qual",palette = "Dark2") +
theme_void() +
guides(fill = F)
```
teste

Chart does not render with the new CN1aChartEngine library

Here is the code:
public Component getCombinedTemperatureChart(Context context) {
/**
* Title for each line
*/
String[] titles = new String[]{"Temp 1", "Temp 2"};
/**
* x-axis values
*/
List<double[]> x = new ArrayList<double[]>();
for (int i = 0; i < titles.length; i++) {
x.add(new double[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12});
}
/**
* Value sets
*/
List<double[]> values = new ArrayList<double[]>();
values.add(new double[]{12.3, 12.5, 13.8, 16.8, 20.4, 24.4, 26.4, 26.1, 23.6, 20.3, 17.2,
13.9});
values.add(new double[]{9, 10, 11, 15, 19, 23, 26, 25, 22, 18, 13, 10});
/**
* Colors and Styles for renderer
*/
int[] colors = new int[]{Color.GREEN, Color.rgb(200, 150, 0)};
PointStyle[] styles = new PointStyle[]{PointStyle.CIRCLE, PointStyle.DIAMOND};
XYMultipleSeriesRenderer renderer = buildRenderer(colors, styles);
renderer.setPointSize(5.5f);
int length = renderer.getSeriesRendererCount();
for (int i = 0; i < length; i++) {
XYSeriesRenderer r = (XYSeriesRenderer) renderer.getSeriesRendererAt(i);
r.setLineWidth(5);
r.setFillPoints(true);
}
setChartSettings(renderer, "Weather data", "Month", "Temperature", 0.5, 12.5, 0, 40,
Color.LTGRAY, Color.LTGRAY);
renderer.setXLabels(12);
renderer.setYLabels(10);
renderer.setShowGrid(true);
renderer.setXLabelsAlign(Paint.Align.CENTER);
renderer.setYLabelsAlign(Paint.Align.RIGHT);
XYValueSeries sunSeries = new XYValueSeries("Demo 1");
sunSeries.add(1f, 35, 4.3);
sunSeries.add(2f, 35, 4.9);
sunSeries.add(3f, 35, 5.9);
sunSeries.add(4f, 35, 8.8);
sunSeries.add(5f, 35, 10.8);
sunSeries.add(6f, 35, 11.9);
sunSeries.add(7f, 35, 13.6);
sunSeries.add(8f, 35, 12.8);
sunSeries.add(9f, 35, 11.4);
sunSeries.add(10f, 35, 9.5);
sunSeries.add(11f, 35, 7.5);
sunSeries.add(12f, 35, 5.5);
XYSeriesRenderer lightRenderer = new XYSeriesRenderer();
lightRenderer.setColor(Color.YELLOW);
XYSeries waterSeries = new XYSeries("Demo 2");
waterSeries.add(1, 16);
waterSeries.add(2, 15);
waterSeries.add(3, 16);
waterSeries.add(4, 17);
waterSeries.add(5, 20);
waterSeries.add(6, 23);
waterSeries.add(7, 25);
waterSeries.add(8, 25.5);
waterSeries.add(9, 26.5);
waterSeries.add(10, 24);
waterSeries.add(11, 22);
waterSeries.add(12, 18);
XYSeries waterSeries2 = new XYSeries("Demo 3");
waterSeries2.add(1, 15);
waterSeries2.add(2, 14);
waterSeries2.add(3, 14);
waterSeries2.add(4, 15);
waterSeries2.add(5, 18);
waterSeries2.add(6, 22);
waterSeries2.add(7, 24);
waterSeries2.add(8, 25);
waterSeries2.add(9, 24);
waterSeries2.add(10, 21);
waterSeries2.add(11, 18);
waterSeries2.add(12, 16);
renderer.setBarSpacing(0.3);
XYSeriesRenderer sunSeries1 = new XYSeriesRenderer();
sunSeries1.setColor(0xff0011cc);
sunSeries1.setChartValuesTextAlign(Paint.Align.CENTER);
XYSeriesRenderer waterRenderer1 = new XYSeriesRenderer();
waterRenderer1.setColor(0xff0099cc);
waterRenderer1.setChartValuesTextAlign(Paint.Align.CENTER);
XYSeriesRenderer waterRenderer2 = new XYSeriesRenderer();
waterRenderer2.setColor(0xff9933cc);
waterRenderer2.setChartValuesTextAlign(Paint.Align.RIGHT);
XYMultipleSeriesDataset dataset = buildDataset(titles, x, values);
dataset.addSeries(0, sunSeries);
dataset.addSeries(0, waterSeries);
dataset.addSeries(0, waterSeries2);
renderer.addSeriesRenderer(0, lightRenderer);
renderer.addSeriesRenderer(0, waterRenderer1);
renderer.addSeriesRenderer(0, waterRenderer2);
renderer.setApplyBackgroundColor(true);
renderer.setBackgroundColor(Color.argb(50, 250, 210, 190));
waterRenderer1.setDisplayChartValues(true);
waterRenderer1.setChartValuesTextSize(10);
waterRenderer2.setDisplayChartValues(true);
waterRenderer2.setChartValuesTextSize(10);
ChartFactory.getLineChartView(context, dataset, renderer).setZoomRate(5f);
ChartFactory.getLineChartView(context, dataset, renderer).getCurrentSeriesAndPoint();
return ChartFactory.getLineChartView(context, dataset, renderer).getPeer();
}
This method returns chart as component. I called this method in the form of:
chart = demo.getCombinedTemperatureChart(context);
addComponent(BorderLayout.CENTER, chart);
With the older library the chart renders correctly but with the new library of CN1aChartEngine, I got this exception:
java.lang.NullPointerException
at org.achartengine.chart.XYChart.draw(XYChart.java:374)
at org.achartengine.GraphicalView.onDraw(GraphicalView.java:195)
at org.achartengine.compat.View$Peer.run(View.java:208)
at com.codename1.ui.Display$1.run(Display.java:775)
at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
[Task Thread] 0:0:0,0 - java.lang.NullPointerException
[Task Thread] 0:0:0,1 - java.lang.NullPointerException
While debugging I get that, this exception occurs when form.show() called not at the moment when the getCombinedTemperatureChart(Context context) method returns the chart component.
I didn't get why this exception occurs with the updated CN1aChartEngine library. Little help would be nice.
Looks like you're using the older 1.0.x line (i.e. using Pisces). I have reproduced the problem (in that line) and fixed it. You can download the latest at
https://github.com/shannah/CN1aChartEngine/releases/tag/1.0.2

Resources